Forum Discussion
MAT Calculation
- 5 years ago
Hi Anonymous ,
Sorry, it was an oversight on my part and I have adjusted the relevant measure😋:
Percentage22 = DIVIDE ( (CALCULATE ( COUNTA ( 'rclms_qa'[CONFORMITY] ), FILTER ( ALL(rclms_qa), rclms_qa[Period] = MAX ( rclms_qa[Period] ) && rclms_qa[Year] = MAX ( rclms_qa[Year] ) ) ) - CALCULATE ( COUNTA ( 'rclms_qa'[CONFORMITY] ), FILTER ( ALL(rclms_qa), rclms_qa[Period] = IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) < 10 || INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) = 14, "P" & "0" & IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) = 14, 1, INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) ), "P" & INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) ) && rclms_qa[Year] =IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ))) =13, MAX ( rclms_qa[Year] ), MAX ( rclms_qa[Year] ) - 1) ) )), CALCULATE ( COUNTA ( 'rclms_qa'[CONFORMITY] ), ALL ( 'rclms_qa') ) ) * 100YEARTEST = IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) )=13, MAX ( rclms_qa[Year] ), MAX ( rclms_qa[Year] ) - 1)Best Regards
Lucien
Hi Anonymous ,
Try the following measure:
Percentage22 =
DIVIDE (
(CALCULATE (
COUNTA ( 'rclms_qa'[CONFORMITY] ),
FILTER (
ALL(rclms_qa),
rclms_qa[Period] = MAX ( rclms_qa[Period] )
&& rclms_qa[Year] = MAX ( rclms_qa[Year] )
)
)
- CALCULATE (
COUNTA ( 'rclms_qa'[CONFORMITY] ),
FILTER (
ALL(rclms_qa),
rclms_qa[Period]
= IF (
INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) < 10
|| INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) = 14,
"P" & "0"
& IF (
INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) = 14,
1,
INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 )
),
"P"
& INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 )
)
&& rclms_qa[Year]
= MAX ( rclms_qa[Year] ) - 1
)
)),
CALCULATE ( COUNTA ( 'rclms_qa'[CONFORMITY] ), ALL ( 'rclms_qa') )
) * 100
(the picture (3-1)/14=14.29)
This measure, will automatically calculate the difference between the date in the column and the date before the 13 stages, and then divided by the total, I provide my PBIX, which has some of my thinking and verification steps, you can refer to, I hope it will be useful to you.
Best Regards
Lucien
Dear v-luwang-msft
Thanks a lot - I'm really impressed by the work & formula.
I have one doubt regarding the calculation because if we are in P13 2020, 13 periods earlier, we should be in P1 2020 (and not P1 2019) -> no?
Thanks
Hervé
- v-luwang-msft5 years agoCommunity Support
Hi Anonymous ,
Sorry, it was an oversight on my part and I have adjusted the relevant measure😋:
Percentage22 = DIVIDE ( (CALCULATE ( COUNTA ( 'rclms_qa'[CONFORMITY] ), FILTER ( ALL(rclms_qa), rclms_qa[Period] = MAX ( rclms_qa[Period] ) && rclms_qa[Year] = MAX ( rclms_qa[Year] ) ) ) - CALCULATE ( COUNTA ( 'rclms_qa'[CONFORMITY] ), FILTER ( ALL(rclms_qa), rclms_qa[Period] = IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) < 10 || INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) = 14, "P" & "0" & IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) = 14, 1, INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) ), "P" & INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) + 1 ) ) && rclms_qa[Year] =IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ))) =13, MAX ( rclms_qa[Year] ), MAX ( rclms_qa[Year] ) - 1) ) )), CALCULATE ( COUNTA ( 'rclms_qa'[CONFORMITY] ), ALL ( 'rclms_qa') ) ) * 100YEARTEST = IF ( INT ( VALUE ( RIGHT ( MAX ( rclms_qa[Period] ), 2 ) ) )=13, MAX ( rclms_qa[Year] ), MAX ( rclms_qa[Year] ) - 1)Best Regards
Lucien
- Anonymous5 years agoNot applicable
Hello Lucien,
I'm sorry - I have another question. I was trying to make a graph/year:
We are in P08 2021 -> why it's stopped at P05?
Thanks
Hervé
- Anonymous5 years agoNot applicable
v-luwang-msft my bad, I have the answer. Thanks Lucien
- Anonymous5 years agoNot applicable
- v-luwang-msft5 years agoCommunity Support
Hi Anonymous ,
Try to change ALL( 'Tablename') in measure you used to be ALLSELECTED('Tablename').
Best Regards
Lucien