Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a table that includes reporting dates and balances of all accounts for every day. I'm trying to create a measure that will sum all the balances in the table when the reporting date is the last day of the previous year without hard coding what that date is. On the report the user has a slicer where they can select which reporting date they want to view so if they selected 2023-02-15 then this measure would show the sum of balances where the reporting date is 2022-12-31. If they selected 2022 -05-15 then it would show for 2021-12-31. Could anyone help me write up the DAX for that?
Solved! Go to Solution.
Try
Balance end of prev year =
VAR ChosenDate =
SELECTEDVALUE ( 'Date'[Date] )
VAR EndPrevYear =
DATE ( YEAR ( ChosenDate ) - 1, 12, 31 )
VAR Result =
CALCULATE ( [sum of balances], 'Date'[Date] = EndPreYear )
RETURN
Result
Try
Balance end of prev year =
VAR ChosenDate =
SELECTEDVALUE ( 'Date'[Date] )
VAR EndPrevYear =
DATE ( YEAR ( ChosenDate ) - 1, 12, 31 )
VAR Result =
CALCULATE ( [sum of balances], 'Date'[Date] = EndPreYear )
RETURN
Result
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 127 | |
| 88 | |
| 78 | |
| 66 | |
| 65 |