Forum Discussion
brianlehr
Microsoft Employee
4 years agoPercentage of rows with specific string
Easy question here (I think, as I haven't done PowerBI in a couple years and all my skills have left me): I have a table like this Team Status Team1 Red Team1 Green Team2 Red ...
- 4 years ago
pls create a status table
and create a measure
Measure = CALCULATE(COUNTROWS('Table'),'Table'[Status]=max('Table (2)'[status]))/COUNTROWS('Table')
MahyarTF
Memorable Member
4 years agoHi,
To show the Teamname add the below column to your table :
TeamName = left(Sheet43[Team Status],5)
Then create three separate Measure for each color :
YellowRatio =
Var Allcnt = COUNT(Sheet43[Team Status])
Var Yellowcnt = CALCULATE(count(Sheet43[Team Status]),
SEARCH("Yellow",Sheet43[Team Status],1,0)
)
return COALESCE( Yellowcnt/Allcnt, 0)
* Do this for other colors (change the color in the search function)
- select 'Percentage' as a Format for particular measures.
- use the measure in your Multi card Visual
brianlehr
Microsoft Employee
4 years agoAccepted the other answer since I tried it first, but I'm going to also try this to see if it gives more flexibility. Never used the COALESCE command before. Thanks!