Quantcast
Channel: SQL Server Analysis Services Forum
Viewing all articles
Browse latest Browse all 2472

MDX Problem with measures on rows

$
0
0

Hello,

I´m having a problem with mdx getting what I want to do. I want to make a query for a graph inside a SSRS report.

For grouping like this I need to have the measures 'Omzet', 'Schade', 'Bruto marge' on rows and also a manual grouping for the (DZA100) and (DZA200)

For that I created this mdx query:

WITH MEMBER [Measures].DZGroep AS 
CASE [Relatie].[Klantgroep kpm Hierarchy].currentmember
   WHEN [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Other].&[06 directe zaken].&[DZA100] THEN '(DZA100)'
   WHEN [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Other].&[06 directe zaken].&[DZA200] THEN '(DZA200)'
   WHEN [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Other].&[06 directe zaken].&[DZA208] THEN '(DZA200)'
   WHEN [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Other].&[06 directe zaken].&[DZA300] THEN '(DZA300)'
   WHEN [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Other].&[06 directe zaken].&[DZA301] THEN '(DZA300)'
   WHEN [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Other].&[06 directe zaken].&[DZA400] THEN '(DZA400))'
   ELSE "Overig"
END

SELECT 
   NON EMPTY  {[Measures].[Omzet], [Measures].[Schade], [Measures].[Bruto Marge], [Measures].DZGroep} ON columns, 
   NON EMPTY { ([Relatie].[Klantgroep kpm Hierarchy].[Relatie Nr Plus Naam].ALLMEMBERS *
	  
	  [CombinedView Date].[Year].[Year].ALLMEMBERS )}
	  
	  
    DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM 
( SELECT ( { [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Other].&[06 directe zaken],
     [Relatie].[Klantgroep kpm Hierarchy].[Hoofd Klantgroep KPM].&[Traditional channel].&[02 reisburo].&[DZT100] }*
     {[CombinedView Date].[Date].[Year].[2012],[CombinedView Date].[Date].[Year].[2011]} ) ON COLUMNS
      FROM [Omzet])

The result is this:

 

                                                  Omzet   Schade  Bruto Marge   DZGroep
DZA100 company name  2011    4,915.28  2551.63     8,241.06  (DZA100)
DZA100 company name  2012    2,434.38    998.18     9,683.99  (DZA100)
DZA200 company name  2011    5,114.99  2638.40     6,472.05  (DZA200)
DZA200 company name  2012    3,254.80  1838.38     5,416.42  (DZA200)
DZA201 company name  2011         58.00       3.58            6.73    Overig
DZA201 company name  2012           0.00     11.48            1.48    Overig

But I need it to be like this:

                                                                 Amount   DZGroep
DZA100 company name  2011 Omzet           4,915.28  (DZA100)
DZA100 company name  2011 Schade           2551.63  (DZA100)
DZA100 company name  2011 Bruto Marge   8,241.06  (DZA100)
DZA100 company name  2012 Omzet           2,434.38  (DZA100)
DZA100 company name  2012 Schade             998.18  (DZA100)
DZA100 company name  2012 Bruto Marge   9,683.99  (DZA100)
DZA200 company name  2011 Omzet           5,114.99  (DZA200)
DZA200 company name  2011 Schade           2638.40  (DZA200)
DZA200 company name  2011 Bruto Marge   6,472.05  (DZA200)
DZA200 company name  2012 Omzet           3,254.80  (DZA200)
DZA200 company name  2012 Schade           1838.38  (DZA200)
DZA200 company name  2012 Bruto Marge   5,416.42  (DZA200)
DZA201 company name  2011 Omzet                58.00    Overig
DZA201 company name  2011 Schade                 3.58    Overig
DZA201 company name  2011 Bruto Marge          6.73    Overig
DZA201 company name  2012 Omzet                  0.00    Overig
DZA201 company name  2012 Schade               11.48    Overig
DZA201 company name  2012 Bruto Marge          1.48    Overig

I tried a lot of things but can't get it right, if anybody could help, please.

Edo.



Viewing all articles
Browse latest Browse all 2472

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>