Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
aquamad96
Frequent Visitor

Matrix showing wrong values

I am having a problem with matrix tables showing the correct values for my measures.

I have a table with Regions as rows, then I have my average $ per kg measures as values, including 3M and 12M averages.

However it seems these values will not populate the table correctly and just stick to the same average $ per kg value in column 2.

 

aquamad96_1-1726233469286.png

 

My measure for 3M Rolling is here:

 

3M Average Cumulative $ per kg =
VAR Three = CALCULATE([Average $ per kg],DATESINPERIOD('Air Freight Spend'[MonthYear], MAX('Air Freight Spend'[MonthYear]), -3, MONTH))

RETURN IF(MAX('Air Freight Spend'[MonthYear]) >= DATE(2022, 3, 1), Three, BLANK())

 

Is this something to do with my month year filter?

 

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @aquamad96 -you can use SUMMARIZE and CALCULATETABLE, to gain more control over the rolling period, ensuring that you're averaging the last 3 months correctly.

modified measure:

3M Average Cumulative $ per kg =
VAR LastVisibleDate = MAX('Air Freight Spend'[MonthYear])
VAR ThreeMonthPeriod =
CALCULATETABLE(
SUMMARIZE(
'Air Freight Spend',
'Air Freight Spend'[MonthYear],
"AvgPerKg", [Average $ per kg]
),
DATESINPERIOD(
'Air Freight Spend'[MonthYear],
LastVisibleDate,
-3,
MONTH
)
)
VAR ThreeMonthAvg =
AVERAGEX(ThreeMonthPeriod, [AvgPerKg])

RETURN
IF(
LastVisibleDate >= DATE(2022, 3, 1),
ThreeMonthAvg,
BLANK()
)

 

Hope it helps, check the above measure let know 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @aquamad96 ,

 

Based on the information you provided, I have created the following data table.

vdengllimsft_0-1726816519704.png


Your 3M Rolling measure works fine for me.

vdengllimsft_1-1726816703797.png

 

Can you provide some sample data? We can better understand the problem and help you.

Or show it as a screenshot or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

Please see the attached pbix for refrence.

Best Regards,

Dengliang Li

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

rajendraongole1
Super User
Super User

Hi @aquamad96 -you can use SUMMARIZE and CALCULATETABLE, to gain more control over the rolling period, ensuring that you're averaging the last 3 months correctly.

modified measure:

3M Average Cumulative $ per kg =
VAR LastVisibleDate = MAX('Air Freight Spend'[MonthYear])
VAR ThreeMonthPeriod =
CALCULATETABLE(
SUMMARIZE(
'Air Freight Spend',
'Air Freight Spend'[MonthYear],
"AvgPerKg", [Average $ per kg]
),
DATESINPERIOD(
'Air Freight Spend'[MonthYear],
LastVisibleDate,
-3,
MONTH
)
)
VAR ThreeMonthAvg =
AVERAGEX(ThreeMonthPeriod, [AvgPerKg])

RETURN
IF(
LastVisibleDate >= DATE(2022, 3, 1),
ThreeMonthAvg,
BLANK()
)

 

Hope it helps, check the above measure let know 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors