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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

MAT Calculation

Dear all,

I'm totally novice using the DAX. I would like to calculate a MAT value from the today (ex. we are in P7) over the last 13 periods.

We will make P7 2021 - P72020

 

YearsPeriods% Grade A
2021P0787,59
2021P0686,78
2021P0587,06
2021P0487,37
2021P0386,17
2021P0286,82
2021P0186,9
2020P1386,64
2020P1286,81
2020P1185,87
2020P1087,58
2020P0987,21
2020P0886,02
2020P0786,44

In this case result is => % diff = 1,15 %

Should appear like this for the actual period (P7) (% is wring in this example):

HerveRC_2020_0-1627647351792.png

And I would like to make a graph with the calculation:

HerveRC_2020_1-1627647415270.png

 

 

% Grade A is calculated like this:

Percentage = DIVIDE(CALCULATE(
COUNTA('rclms_qa'[CONFORMITY]),
ALLSELECTED('rclms_qa'[CONFORMITY])
),CALCULATE(
COUNTA('rclms_qa'[CONFORMITY]),
ALL('rclms_qa'[CONFORMITY])
))*100
 
Thanks a lot for your help,
Hervé
1 ACCEPTED SOLUTION
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try the following formula:

 

Measure = 
[% Grade A] - CALCULATE(
                [% Grade A],
                FILTER(
                    ALLSELECTED(rclms_qa[Years]),
                    rclms_qa[Years] = MAX(rclms_qa[Years]) - 1
                )
            )

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

View solution in original post

2 REPLIES 2
v-kkf-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try the following formula:

 

Measure = 
[% Grade A] - CALCULATE(
                [% Grade A],
                FILTER(
                    ALLSELECTED(rclms_qa[Years]),
                    rclms_qa[Years] = MAX(rclms_qa[Years]) - 1
                )
            )

image.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Anonymous
Not applicable

Great - it works. Thanks @v-kkf-msft 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.