Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

How do I get the difference of balances between dates?

Hello,   I am trying to figure out a way to calculate the difference in balances when I select multiple dates in my slicer. For example, if balance in 12/31/2023 was 11m and balance in 1/31/2024 is...
  • Ashish_Mathur's avatar
    2 years ago

    Hi,

    Create a Calendar Table and a retionship (Many to One and Single) from the ProdDate column of your Data Table to the Date column of the Calendar Table.  To your slicer, drag the Date column from the Calendar Table and select 2 dates.  Write these measures

    Total = sum(Data[Amount])

    Total on first date = calculate([Total],datesbetween(Calendar[date],min(calendar[date]),min(calendar[date])))

    Total on second date = calculate([Total],datesbetween(Calendar[date],max(calendar[date]),max(calendar[date])))

    Variance = [Total on first date]-[Total on second date]

    Hope this helps.