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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Hi all,
I have a Matrix that compares Quarter over Quarter numbers, as well as yearly quarters (Q2 2023 vs Q2 2024).
What I am needing is a Measure that fills in empty months within a quarter with the average value of the last 3 completed months.
Example: I have April and May data for Q2, I need something that would fill in June with an "Estimate" that is the average of the last 3 months, in this case March, April, May.
I would need this to be done for all out months.
This is my current DAX for calculating the Estimate which seems to be working, I just need help with the part of applying this in the right scenarios:
IF (DISTINCT Months IN Qtr = 0) THEN ~DAX for Average from last 3 months~
Applied to PARALLELPERIODS +1 & +2 & +3
IF (DISTINCT Months IN Qtr = 1) THEN ~DAX for Average from last 3 months~
Applied to PARALLELPERIODS +1 & +2
IF (DISTINCT Months IN Qtr = 2) THEN ~DAX for Average from last 3 months~
Applied to PARALLELPERIODS +1
IF (DISTINCT Months IN Qtr = 3) THEN Do Nothing
Thanks!
Solved! Go to Solution.
Hi,@Kaiden I am glad to help you.
You can refer to my test below
M_result =
VAR _DATE=CALCULATE(MAX(Sheet2[Date]),FILTER(ALL(Sheet2),'Sheet2'[QuarterNum]=MAX('Sheet2'[QuarterNum])&&'Sheet2'[YearNum]=MAX('Sheet2'[YearNum])))
VAR _DATE_Two=EOMONTH(_DATE,-3)+1
RETURN
SWITCH(TRUE(),
[M_eachMonNum_Aquarter1] = 1,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]>=_DATE_Two&&Sheet2[Date]<=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 2,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]>=_DATE_Two&&Sheet2[Date]<=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 3,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]>=_DATE_Two&&Sheet2[Date]<=_DATE),Sheet2[Cost])/3
)
calculate column
YearNum = YEAR('Sheet2'[Date])
QuarterNum = QUARTER('Sheet2'[Date])
MonthNum = MONTH('Sheet2'[Date])
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,@Kaiden I am glad to help you.
You can refer to my test below
M_result =
VAR _DATE=CALCULATE(MAX(Sheet2[Date]),FILTER(ALL(Sheet2),'Sheet2'[QuarterNum]=MAX('Sheet2'[QuarterNum])&&'Sheet2'[YearNum]=MAX('Sheet2'[YearNum])))
VAR _DATE_Two=EOMONTH(_DATE,-3)+1
RETURN
SWITCH(TRUE(),
[M_eachMonNum_Aquarter1] = 1,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]>=_DATE_Two&&Sheet2[Date]<=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 2,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]>=_DATE_Two&&Sheet2[Date]<=_DATE),Sheet2[Cost])/3,
[M_eachMonNum_Aquarter1] = 3,
SUMX(FILTER(ALL(Sheet2),Sheet2[Date]>=_DATE_Two&&Sheet2[Date]<=_DATE),Sheet2[Cost])/3
)
calculate column
YearNum = YEAR('Sheet2'[Date])
QuarterNum = QUARTER('Sheet2'[Date])
MonthNum = MONTH('Sheet2'[Date])
I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Carson Jian,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 17 | |
| 16 | |
| 12 | |
| 5 | |
| 5 |