Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
97 | |
78 | |
64 | |
55 |
User | Count |
---|---|
143 | |
109 | |
89 | |
84 | |
66 |