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 this query that is meant to calculate the data from last year every time i select the current year it should get previous data without having to hard code the year into the dax
Hi @ganiu_s - Create a Date Table (if not already done) using new table Dax.
Mark DateTable as a Date table by going to Table tools >> Mark as Date Table, and select the Date column.
create a new measure
VolumePreviousYear =
VAR SelectedYear = SELECTEDVALUE('DateTable'[Year]) - 365
RETURN
CALCULATE(
COUNT('YourTableName'[ID]),
FILTER(
ALL('DateTable'),
'DateTable'[Year] = SelectedYear
)
)
Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!
Proud to be a Super User! | |
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 33 | |
| 29 |
| User | Count |
|---|---|
| 134 | |
| 96 | |
| 78 | |
| 67 | |
| 65 |