简体   繁体   中英

SSAS MDX Query with Grouped Value

I created Calculation Member which one shows a percentage ratio transactions amount to concrete institution.

 Case When IsEmpty ( [Measures].[Zlicz transakcje] ) 
 Then Null
 Else ROUND((( [Klient].[Instytucja].[Klient].CurrentMember,
   [Measures].[Zlicz transakcje] ) 
  /
  ( Root    ( [Klient] ), [Measures].[Zlicz transakcje] )) *100, 2 )
 End

The result of my query looks like:

在此处输入图片说明

Query: How to change MDX query to shows percentage usage for all institutions (except for "Brak instytucji") grouped in one rows (I mean one row with 13,05 value)?

Couple of things I'd recommend

  • not use CASE - general rul-of-thumb is that IIF is quicker.
  • for readability I prefer the DIVIDE function.
  • rather than Root why not just use the ALL member?

Code would now be something like this:

 IIF(
   [Measures].[Zlicz transakcje] = 0 
  , NULL
  , ROUND(
      100 * 
      DIVIDE(
        ( [Klient].[Instytucja].[Klient].CurrentMember, [Measures].[Zlicz transakcje] ) 
      , ( [Klient].[Instytucja].[All], [Measures].[Zlicz transakcje] )
      )
      , 2 
    )

You can create an aggregated member that excludes Brak instytucji:

AGGREGATE(
  EXCEPT(
     [Klient].[Instytucja].[Klient].MEMBERS
    ,[Klient].[Instytucja].[Klient].[Brak instytucji]
  )
)

)

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