Showing posts with label selection. Show all posts
Showing posts with label selection. Show all posts

Monday, March 26, 2012

Refresh selection in Query Analyzer?

I add a new table and I want to see it in my list, I can go to EM and refresh there but it appears I have to close QA in order to see the new table. Is there a refresh option in QA to see my new object?

thx,

Kat

Never Mind, I found it, use F5.

Kat

Friday, March 23, 2012

Reformat Data

I have a problem in that I need to reformat my data.

I have the data for part numbers to products from the selection.
e.g.

Part No Product Application
001 aaaa Standard
001 bbbb Option
002 aaaa Option
002 bbbb Standard
003 aaaa Option

and I wish reformat it into

Part No aaaa bbbb
001 Standard Option
002 Option Standard
003 Option Not App (Note missing from above selection)

There could be several products with various parts applicable / not applicableThis may be a little crude, and I'm sure that someone can point out better ways to do it. However it does work with the limited example that you describe.

The first part is just me building a temptable to select from

Hope it helps,

Brent

Create Table #TempParts (PartNo int, parttype varchar(5), description varchar(10))
insert #tempparts values(001, 'aaaa', 'standard')
insert #tempparts values(001, 'bbbb', 'option')
insert #tempparts values(002, 'bbbb', 'standard')
insert #tempparts values(002, 'aaaa', 'option')
insert #tempparts values(003, 'aaaa', 'option')

select PartNo,
Max(Case parttype when 'aaaa' then [description] end) as AAAA,
Max(Case parttype when 'bbbb' then [description] end) as BBBB
from #tempparts
group by partno|||Thanks for your reply but the problem is when I do the query on part no's I don't know at that time to what selection of Products they are applicable, and unfortunately there are hundreds of possible products.|||Do you have an equally large amount of Part No's as Products? What about Applications? Just trying to get an idea of the variables that need to be arranged in some sort of pivot table.

Friday, March 9, 2012

Reference axis(2) members in MDX

Hello everybody.

I've got a little problem: I want to reference axis(2) members in a calculated member, so I can use multiple selection.

I've tried:

with member [Measures].[Test] as 'settostr(axis(2))'

select {[Measures].[Test]} on 0,

{[Dim Sales Territory].[Sales Territory Region].members} on 1

from [Adventure Works DW]

where ([Dim Geography].[Country Region Code].&[US],[Dim Geography].[Country Region Code].&[CA])

However, I get an error.

Is there any other way?

Thanks a lot,

Santi

The Axis function cannot be used on the filter axis.The Axis function cannot be used on the filter axis.

http://msdn2.microsoft.com/en-us/library/ms145531.aspx

your shuldn't use Axis function if you whant to use multiple filter

|||

Thanks Vladimir.

Then, assuming I have several members on the filter axis, how can I find out what those members are?

Is it at all possible?

The thing is, I'm trying to enable multiple selection in a dimension, and the selected members go directly to the where clause of the query. Since I have some calculated measures, I can′t reference those members using currentmember.

Thanks again for your answer.

|||What the client do you use? Do you have a full control on it.|||

You could use the Existing function:

>>

with member [Measures].[Test] as

settostr(Existing [Geography].[Country].[Country].Members)

select {[Measures].[Test]} on 0

from [Adventure Works]

where {[Geography].[Country].&[United States],

[Geography].[Country].&[Canada]}

-

Test
{[Geography].[Country].&[Canada],[Geography].[Country].&[United States]}

>>

This technique is discussed in detail here:

http://sqljunkies.com/WebLog/mosha/archive/2005/11/18/multiselect_friendly_mdx.aspx

>>

Writing multiselect friendly MDX calculations

>>

|||

Thanks a lot Deepak!

Didn't know about Exist and Existing at all.

I've also read Mosha's blog entry, and it explains exactly the internals of what I'm trying to acomplish.