Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Case statement issue in MDX query....?

$
0
0

With MEMBER [Measures].[Week4] AS ( [Measures].[Teu], [Date].[Week].CurrentMember.Lag(3) ) MEMBER [Measures].[Week3] AS ( [Measures].[Teu], [Date].[Week].CurrentMember.Lag(2) ) MEMBER [Measures].[Week2] AS ( [Measures].[Teu], [Date].[Week].CurrentMember.Lag(1) ) MEMBER [Measures].[Week1] AS ( [Measures].[Teu], [Date].[Week].CurrentMember ) MEMBER [Measures].[WeekSum] AS Sum({[Date].[Week].CurrentMember.Lag(3) : [Date].[Week].CurrentMember}, [Measures].[Teu]) Select {[Measures].[Week4],[Measures].[Week3], [Measures].[Week2],[Measures].[Week1], [Measures].[WeekSum]} on 0, case when [Dimtop].[Id].&[1]=[Dimtop].[Id].currentmember then Topcount([Commodity _flat].[Commodity].[Commodity].Members,5,[Measures].[WeekSum]) when [Dimtop].[Id].&[2]=[Dimtop].[Id].currentmember then Topcount([Commodity _flat].[Commodity].[Commodity].Members,10,[Measures].[WeekSum]) else Topcount([Commodity _flat].[Commodity].[Commodity].Members,25,[Measures].[WeekSum]) End on 1 From [Commodities]

where (Strtomember("[Date].[Week].&[2012010101]",CONSTRAINED), Strtomember("[Dimtop].[Id].&[2]",CONSTRAINED))

HI.,

         here case statement fails for second condition., kindly suggest  where the mistake is..?

The output is always first condition. returns only top 5..,


Thanks, Avula.GK



Viewing all articles
Browse latest Browse all 10045

Trending Articles



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