Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello, I have a report that I pull into Power BI with this example information (the table on the left), and I would like to calculate (in a measure I assume) that if only the LAST 3 (#type) consecutive surveys (assigned with this type T1 until T6 but some classes can reach less than T6) and each one is greater than or equal to 85% the final result of the class puts me "Approved", otherwise I put "failed" (if one of the LAST 3 is less than ).
Class | #Type | Result | FINAL RESULT | ||
A | T1 | 80% | Class | Measure | |
A | T2 | 81% | A | approved | |
A | T3 | 79% | Y | approved | |
A | T4 | 85% | Z | not approved | |
A | T5 | 86% | |||
A | T6 | 87% | |||
Y | T1 | 78% | |||
Y | T2 | 85% | |||
Y | T3 | 86% | |||
Y | T4 | 85% | |||
Z | T1 | 86% | |||
Z | T2 | 85% | |||
Z | T3 | 85% | |||
Z | T4 | 75% | |||
Z | T5 | 86% |
last 3 of each class: A(T4,T5,T6), Y(T2,T3,T4), Z(T3,T4,T5)
Solved! Go to Solution.
try
Status measure =
IF (
HASONEVALUE ( 'Table'[Class] ),
VAR SummaryTable =
TOPN ( 3, 'Table', 'Table'[#Type] )
VAR NumPasses =
COUNTROWS ( FILTER ( SummaryTable, 'Table'[Result] >= 0.85 ) )
RETURN
IF ( NumPasses = 3, "approved", "not approved" )
)
try
Status measure =
IF (
HASONEVALUE ( 'Table'[Class] ),
VAR SummaryTable =
TOPN ( 3, 'Table', 'Table'[#Type] )
VAR NumPasses =
COUNTROWS ( FILTER ( SummaryTable, 'Table'[Result] >= 0.85 ) )
RETURN
IF ( NumPasses = 3, "approved", "not approved" )
)
Thanks @johnt75 this worked. Could you explain to me how each line works please? because I understand that TOPN takes the first 3, but in your solution I see that if it is taking the last 3. I am confused.
By default TOPN sorts in descending order, that's what its doing here.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
93 | |
86 | |
80 | |
69 | |
68 |
User | Count |
---|---|
226 | |
129 | |
119 | |
83 | |
77 |