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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Rambo92
Helper I
Helper I

Pass rate by groups and by date filters

Hi, I need help on this for creating a measure to calculate the pass percentage on the sample Audit data.

 

I need the pass percentage of eac Area where,

0 - No issue,

1 - deduction in 3.5% passrate

2 - deduction in 7% passrate 

3 - deduction in 10% passrate

Rambo92_0-1674145239675.png

The desired output should be something like below.

If Production filter is applied and date as 09/01/2022 - Passrate (100% - 21%) which gives 79%.

If two Areas selected Production and Storage for 09/01/2022 - Passrate (100% - average of both is 17.5%) which gives 82.5%.

 

Thanks in advance.

 

1 ACCEPTED SOLUTION

Ok, then to simplify the code we will add new column with Value logic:

Value logic = 
    SWITCH(SampleData[Value],
        1,0.035,
        2,0.07,
        3,0.1,
        0
    )

 

And the measure will be like this:

Passrate v2 = 
var lowering_table = SUMMARIZE(SampleData,SampleData[Area],SampleData[Date],"SUM",SUM(SampleData[Value logic]))
var lowering_value = AVERAGEX(lowering_table,[SUM])
return IF(NOT(ISBLANK(lowering_value)),1-lowering_value)

 

Result:

bolfri_0-1674216280285.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

9 REPLIES 9
bolfri
Solution Sage
Solution Sage

For your unpivoted data:

Passrate =
var lowering = SUMX(SampleData,
SWITCH(SampleData[Value],
1,0.035,
2,0.07,
3,0.1,
0
)
)
var number_of_areas = DISTINCTCOUNT(SampleData[Area])
var average_lowering = DIVIDE(lowering,number_of_areas)
return IF(NOT(ISBLANK(average_lowering)),1-average_lowering)

 

Results:

bolfri_0-1674211761249.png





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi bolfri,

Thanks for your time.

It is showing the correct required output if one date is selected. But not showing the average pass rate if all dates or multiple dates are selected. 

That's why you should tell me what is correct output value for multiple dates. Is is the AVERAGE SUM per Area?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




It should show 91.3% if all dates selected.

Ok, then to simplify the code we will add new column with Value logic:

Value logic = 
    SWITCH(SampleData[Value],
        1,0.035,
        2,0.07,
        3,0.1,
        0
    )

 

And the measure will be like this:

Passrate v2 = 
var lowering_table = SUMMARIZE(SampleData,SampleData[Area],SampleData[Date],"SUM",SUM(SampleData[Value logic]))
var lowering_value = AVERAGEX(lowering_table,[SUM])
return IF(NOT(ISBLANK(lowering_value)),1-lowering_value)

 

Result:

bolfri_0-1674216280285.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




This is what i am looking for...Thanks a lot mate..

jaweher899
Impactful Individual
Impactful Individual

Please try 

 

Pass Percentage:= CALCULATE( 100 - (SUMX(FILTER(TBL_Sample,TBL_Sample[Issue]=1),TBL_Sample[Passrate])*3.5 + SUMX(FILTER(TBL_Sample,TBL_Sample[Issue]=2),TBL_Sample[Passrate])*7 + SUMX(FILTER(TBL_Sample,TBL_Sample[Issue]=3),TBL_Sample[Passrate])*10) /COUNT(TBL_Sample), FILTER(TBL_Sample,TBL_Sample[Area]=SELECTEDVALUE(TBL_Sample[Area])) )

After importing data into PowerBI, I have unpivotted all date columns. So this is how it looks now.

Rambo92_0-1674146802544.png

Please see above screenshot for reference.

Thanks

Thanks for your reply jaweher899.

 

Should i need to create a new column with Passrate which is multiplied with the value.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors