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
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
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 Fabric 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.