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 am using Average by Category quick measure, which does exactly what I need (average of incident count by month).
However I need it to take into account only last year and not the whole dataset.
How do I adjust the DAX code of this quick measure to incorporate this condition?
Here is the DAX code from the quick measure:
I am a newbie, so the more details the better 🙂
Thank you!
Solved! Go to Solution.
@Zalina , with help from date table try like
Last YTD = CALCULATE([Avergae By Category],DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last year= CALCULATE([Avergae By Category],DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last Year = CALCULATE([Avergae By Category],previousyear('Date'[Date],"12/31"))
@Zalina , with help from date table try like
Last YTD = CALCULATE([Avergae By Category],DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last year= CALCULATE([Avergae By Category],DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last Year = CALCULATE([Avergae By Category],previousyear('Date'[Date],"12/31"))
@amitchandak
Thank you for your help!
The second option worked for me.
I created a new measure and here is the code I used:
It's not exactly the solution for adjusting the quick measure and having one measure for the whole thing, but this serves my purpose.
Much appreciated!
🙂
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 9 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 33 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |