Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have to display the closing_balance for the last month of every period selected. For example if a month is selected the closing balance for that month should be displayed.
However if a quarter is selected the closing balance for the last month of that quarter needs to displayed.And same for the year where the closing balance of the last month of that year needs to be shown. I got the above logic to work using the below function.
FirstSortedValue(Aggr(Sum([YTD_Net_Amount]+Yearly_Opening_Balance), [Time_Sid.Calendar.MonthYear]), -Aggr([Time_Sid.Calendar.MonthYear], [Time_Sid.Calendar.MonthYear]))
However the above function doesnt work when I add other attributes into that report. I have an Account dimension whose drill down goes from Account_Level_1 thru Account_Level_7 and then to account number. When I bring Account dimension into that report it doesnt give me the expected output. I am trying to figure how I can still aggregate closing balance by account number and still show the correct aggregated closing balance for the ending period.
I tried something like this where it works correctly at the month level but it sums up the closing balance when rolled up to Quarter level or Year level
sum(aggr(FirstSortedValue(Aggr(SUM([YTD_Net_Amount]+Yearly_Opening_Balance),Account_Number,[Time_Sid.Calendar.MonthYear]), -Aggr([Time_Sid.Calendar.MonthYear], [Time_Sid.Calendar.MonthYear],Account_Number)),[Time_Sid.Calendar.MonthYear],Account_Number))
Any thoughts on how I need to handle this?
I have not gotten any responses but thought will let the community know how I resolved this particular issue. Here is the expression that did the trick for me.
If((GetPossibleCount([Time_Sid.Calendar.Quarter])=1) ,
(sum(YTD_Net_Amount))
,
if((GetPossibleCount([Time_Sid.Calendar.Year])=1)
,(sum(IF(Time_Sid.Calendar.MonthYear = Aggr(NODISTINCT Max({1} Time_Sid.Calendar.MonthYear),[Time_Sid.Calendar.Quarter],Time_Sid.Calendar.Year), YTD_Net_Amount)))
,
(sum(IF(Time_Sid.Calendar.MonthYear = Aggr(NODISTINCT Max({1} Time_Sid.Calendar.MonthYear),Time_Sid.Calendar.Year), YTD_Net_Amount)))
))
Any thoughts anyone?
I have not gotten any responses but thought will let the community know how I resolved this particular issue. Here is the expression that did the trick for me.
If((GetPossibleCount([Time_Sid.Calendar.Quarter])=1) ,
(sum(YTD_Net_Amount))
,
if((GetPossibleCount([Time_Sid.Calendar.Year])=1)
,(sum(IF(Time_Sid.Calendar.MonthYear = Aggr(NODISTINCT Max({1} Time_Sid.Calendar.MonthYear),[Time_Sid.Calendar.Quarter],Time_Sid.Calendar.Year), YTD_Net_Amount)))
,
(sum(IF(Time_Sid.Calendar.MonthYear = Aggr(NODISTINCT Max({1} Time_Sid.Calendar.MonthYear),Time_Sid.Calendar.Year), YTD_Net_Amount)))
))