简体   繁体   中英

SSRS MDX Where Clause Issue

I have a little Problem with a MDX-Query .

I want show all the Claim Costs, divided in Types and with a certain DocumentType.

Here is my Code:

    select
    {
        [Measures].[Claim Count],
        [Measures].[Claim Cost Position Count],
        [Measures].[Claim Cost Original],
        [Measures].[Claim Cost Original Average],
        [Measures].[Claim Cost Possible Savings],
        [Measures].[Claim Cost Possible Savings Average],
        [Measures].[Claim Cost Possible Savings Percentage]
    } on 0,
    NON EMPTY{
        [Claim Cost Type].[Claim Cost Type].[Claim Cost Type].Members
    } on 1
    from
        Cube    
where 
    (
        ( {StrToMember(@DateFrom) : StrToMember(@DateTo ) } )
         ,[Claim Document Type].[Document Type].&[1] 
    )

I have four Document Types: 1 - 4

I want to show only the data of three first Documenttypes .

I tried the following Where-Clause:

where 
(
    ( {StrToMember(@DateFrom) : StrToMember(@DateTo ) } )
   ,( {[Claim Document Type].[Document Type].&[1] : [Claim Document Type].[Document Type].&[3]} ) 
)

But it shows me only the Data of the Documenttype 1 and 3, not 1 to 3.

Can anybody help me?

Thank you very much and sorry for my bad English!

Alex

Maybe the OrderBy property of [Document Type] attribute is not equal to "Key"? In this case it is necessary to use

{[Claim Document Type].[Document Type].&[1],
 [Claim Document Type].[Document Type].&[2],
 [Claim Document Type].[Document Type].&[3]}

In the below condition

where 
(( {StrToMember(@DateFrom) : StrToMember(@DateTo ) } ),( {[Claim Document Type].[Document Type].&[1] : [Claim Document Type].[Document Type].&[3]} ))

even the following expression should work as this is a range operator.

({[Claim Document Type].[Document Type].&[1] : [Claim Document Type].[Document Type].&3]})

What you need to check when you browse cube for this dimension and attribute [Claim Document Type].[Document Type] does the Dimension KEY order look like

[Claim Document Type].[Document Type].&[1]
[Claim Document Type].[Document Type].&[2]
[Claim Document Type].[Document Type].&[3]

or

[Claim Document Type].[Document Type].&[1]
[Claim Document Type].[Document Type].&[3]
[Claim Document Type].[Document Type].&[2]

If you see order 1,3 and if you enter 1:3 you would not get 2. So look at order and then modify your range expression.

Earlier solution would also work but what if there are lot of member then it is not practical to include all of such members into set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM