Forum Discussion

heman_powerbi's avatar
heman_powerbi
Regular Visitor
9 years ago

Time Intelligence : YoY Closing Balance Look with drilldown on date hierarchy

Have a simple table like a date and amount. The amount is NOT purchase activity but a mortgage ENDING BALANCE. hence if I sum it across time periods we will get values that are not true ending balance.

 

My objective 

- show ending balance and its sameperiodlastyear() balance

- along with drill down behaviour by year and month

 

THe problem is 

1. how do you calculate the ending balance where my context could be month or year in teh same report.

2. if im in monthly timescale, the ending balance should be based on monthly value

3. if im in yearly timescale, they should be ending balance based on yearly value

 

 

 

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    heman_powerbi,

    Firstly, in your original table, create the following measures.

    ClosingBalanceYear = CLOSINGBALANCEYEAR( SUM( Table[amount]), Table[date])
    ClosingBalanceMonth = CLOSINGBALANCEMONTH( SUM( Table[amount]), Table[date])

    Then create the following columns.
    Year = YEAR(Table[date])
    Month = MONTH(Table[date])

    Secondly, create a new table using DAX below.

    BalanceForYear = SUMMARIZE(Table,Table[Year],"YearBalance",[ClosingBalanceYear])

    Then create the following columns in the new table.

    Index = CALCULATE(COUNT('BalanceForYear'[Year]),ALL('BalanceForYear'),FILTER('BalanceForYear','BalanceForYear'[Year]<=EARLIER('BalanceForYear'[Year])))

    Previous year = IF('BalanceForYear'[Index]=1,'BalanceForYear'[YearBalance],LOOKUPVALUE('BalanceForYear'[YearBalance],'BalanceForYear'[Index],'BalanceForYear'[Index]-1))

    YOY = 'BalanceForYear'[YearBalance]-IF('BalanceForYear'[Index]=1,'BalanceForYear'[YearBalance],LOOKUPVALUE('BalanceForYear'[YearBalance],'BalanceForYear'[Index],'BalanceForYear'[Index]-1))




    Thirdly, create another new table using  the following DAX.
    Balance for month = SUMMARIZE(Table,Table[Year],Table[Month],"MonthBalance",[ClosingBalanceMonth])


    Regards,
    Lydia