Quantcast
Channel: SQL Server Analysis Services forum
Viewing all articles
Browse latest Browse all 14337

Time dimension conditional value issue

$
0
0

Hi,

I am new to MDX query. I facing the issue with below query. If I use any of the commented out time dimensions directly for the new Time member "[Time].[LastDayOfSelectedTimePeriod]", it gives me the correct results for "[Measures].[TotalLoansDelinquentCount]" which is defined as a tuple. Each month has some random date defined by business logic. The same dates are in commented out part. For each month theey are different.

But if I try to define [LastDayOfSelectedTimePeriod] dynamically according to current time member through [Measures].[a], I get null values for [TotalLoansDelinquentCount].

Please help with this query or how will be the syntax for Time.CurrentMember.LastChild but with some property value true?

WITH

MEMBER [Measures].[a] as 
IIF([Time].CurrentMember.Unique_Name = "[Time].[Year].&[2011].[Quarter 1].[January]" , "1" ,
IIF([Time].CurrentMember.Unique_Name = "[Time].[Year].&[2011].[Quarter 1].[February]" , "2" ,
IIF([Time].CurrentMember.Unique_Name = "[Time].[Year].&[2011].[Quarter 1].[March]" , "3" , 
IIF([Time].CurrentMember.Unique_Name = "[Time].[Year].&[2011].[Quarter 2].[April]" , "4" , 0
)
)
)


Member [Time].[LastDayOfSelectedTimePeriod] as  
--[Time].[All Time].[2011].[Quarter 1].[January].[25]
--[Time].[All Time].[2011].[Quarter 1].[February].[23]
--[Time].[All Time].[2011].[Quarter 2].[March].[30]
--[Time].[All Time].[2011].[Quarter 2].[April].[20]
case 
when [Measures].[a] = 1 then '[Time].[All Time].[2011].[Quarter 1].[January].[25]'
when [Measures].[a] = 2 then '[Time].[All Time].[2011].[Quarter 1].[February].[23]'
when [Measures].[a] = 3 then '[Time].[All Time].[2011].[Quarter 2].[March].[30]'
when [Measures].[a] = 4 then '[Time].[All Time].[2011].[Quarter 2].[April].[20]'
end , SOLVE_ORDER=3

MEMBER [Measures].[TotalLoansDelinquentCount] as '([Measures].[TotalLoansOutstandingCount],[Time].[LastDayOfSelectedTimePeriod])',SOLVE_ORDER=104
select 
    { [a],([Measures].[TotalLoansDelinquentCount] )} on 0,
    {Filter( LastPeriods(4, [Time].[All Time].[2011].[Quarter 2].[April].[30].Parent ), true ) } on 1
from Portfolio 

-------------------------------

RESULT

        aTotalLoansDelinquentCount
January1(null)
February2(null)
March3(null)
April4(null)



Viewing all articles
Browse latest Browse all 14337

Trending Articles



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