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
Hello everyone,
I have a matrix with dates and a quantity column.
The second quantity column should show quantities from the previous year. That is, if there are 208 quantities in September 2022 and there are 221 quantities in September 2021, it should be displayed in the column "Quantity previous year".
Do you have an idea for a measure?
Initual sitation:
Expected situation:
Solved! Go to Solution.
Hi, @azaterol ;
You could create a measure as follow:
Measure = CALCULATE(SUM('Order'[Quantity]),FILTER(ALL('Date'),EOMONTH([Date],0)=EOMONTH(MAX('Date'[Date]),-12)))
The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @azaterol ;
You could create a measure as follow:
Measure = CALCULATE(SUM('Order'[Quantity]),FILTER(ALL('Date'),EOMONTH([Date],0)=EOMONTH(MAX('Date'[Date]),-12)))
The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Maybe this version could help :
Sales PY =
VAR __Current = MAX('Sales Calendar'[Sales Date])
VAR __PrevStart = DATE(YEAR(__Current)-1,MONTH(__Current),DAY(__Current))
VAR __PrevEnd = DATE(YEAR(__Current)-1,MONTH(__Current),DAY(__Current))
RETURN
SUMX(FILTER('Metrics','Metrics'[Sales_Date] >= __PrevStart && 'Metrics'[Sales_Date] <= __PrevEnd),'Metrics'[Sales€])
@azaterol Try:
Quantity previous year measure =
VAR __Start = MIN('Table'[Date])
VAR __End = MAX('Table'[Date])
VAR __PrevStart = DATE(YEAR(__Start)-1,MONTH(__Start),DAY(__Start))
VAR __PrevEnd = DATE(YEAR(__End)-1,MONTH(__End),DAY(__End))
RETURN
SUMX(FILTER('Table',[Date] >= __PrevStart && [Date] <= __PrevEnd),[Value])
Hello, unfortunately it didn't work. Here is the sample file. At the end what do you mean by value?
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 |
|---|---|
| 66 | |
| 46 | |
| 42 | |
| 26 | |
| 19 |
| User | Count |
|---|---|
| 196 | |
| 127 | |
| 102 | |
| 67 | |
| 49 |