Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
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
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.
Solved! Go to 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:
Proud to be a Super User!
For your unpivoted data:
Results:
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?
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:
Proud to be a Super User!
This is what i am looking for...Thanks a lot mate..
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.
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.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.