L33
Board Regular
- Joined
- Jul 2, 2008
- Messages
- 108
Hi
I've just started building a Power BI data model that will mostly be used via the Analyze in Excel feature in pivot tables, and have hit a problem that feels like it should be simple, but I am struggling!
I'm returning the sum total balance of transactions at the end of each month, but need to be able to dynamically show these numbers for the last 13 months based on the selection of a single month.
My balance is determined by this DAX:
Followed by this:
Basically - how do I write the DAX so that I can achieve the middle table where I've manually selected 13 months from the slicer above it, but using the slicer for third table where I'm selecting just one month?
I've just started building a Power BI data model that will mostly be used via the Analyze in Excel feature in pivot tables, and have hit a problem that feels like it should be simple, but I am struggling!
I'm returning the sum total balance of transactions at the end of each month, but need to be able to dynamically show these numbers for the last 13 months based on the selection of a single month.
My balance is determined by this DAX:
Code:
Balance (Accumulating Sum of Transaction Amounts) =
VAR MaxDate = MAX ( 'Calendar'[Calendar Post Month] ) -- Saves the last visible date
RETURN
CALCULATE (
[Sum Transactions Amount], -- Computes sales amount
'Calendar'[Calendar Post Month] <= MaxDate, -- Where date is before the last visible date
ALL ( 'Calendar' ) -- Removes any other filters from Date
)
Followed by this:
Code:
Balance at end of Selected Month =
TOTALMTD(
[Balance (Accumulating Sum of Transaction Amounts)],
Calendar[Calendar_Date]
)
Basically - how do I write the DAX so that I can achieve the middle table where I've manually selected 13 months from the slicer above it, but using the slicer for third table where I'm selecting just one month?