Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

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):

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

 

 

% 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é
  • 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
                    )
                )

     

    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.

2 Replies

  • v-kkf-msft's avatar
    v-kkf-msft
    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
                    )
                )

     

    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.