Forum Discussion
Neilt
4 years agoRegular Visitor
Help with percentages
Hi Community, apologies if this seems like a noob question but in desperate need of help. we have a Power BI dataset Already which tells me the records recorded over a monthly period, I even ...
tamerj1
Community Champion
4 years agoHi Neilt
This might not be so accurate as I have no idea about your data structure but you may try one of the following
1. You can have a slicer with "HIT", "MISS" and use the following code
Percentage =
VAR Numerator =
COUNTROWS ( Table )
VAR Denominator =
CALCULATE ( COUNTROWS ( Table ), ALLEXCEPT ( Table, Table[Date] ) )
VAR Result =
DIVIDE ( Numerator, Denominator )
RETURN
ResultThe result percentage will be based on the slicer selection. If you select HIT it will give you the percentage of HIT's and same for MISS
2. code for HIT only
HIT Percentage =
VAR Numerator =
CALCULATE ( COUNTROWS ( Table ), Table[Hit SLA?] = "HIT" )
VAR Denominator =
CALCULATE ( COUNTROWS ( Table ), ALLEXCEPT ( Table, Table[Date] ) )
VAR Result =
DIVIDE ( Numerator, Denominator )
RETURN
Result