Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
I'm new to Power Bi and I'm trying to calculate a % from 2 colums (Made & Missed) in a table but am struggling to figure out how to do it.
I've listed some examples below .
Tackles Made Tackles Missed Tackles Made % (% of total tackles attempted)
10 2 83.3%
12 0 100%
4 1 80%
7 4 63.6%
Any help would be greatly appreciated.
Cheers
J
Solved! Go to Solution.
@jamieham , try like
Measure =
divide(sum(Table[Tackles Made]),sumx(Table,Table[Tackles Missed]+Table[Tackles Made]))
Hey @jamieham ,
I created a calculated column (https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-calculated-columns) using this DAX statement:
Tackles Made % =
ROUND(
DIVIDE('Table'[Tackles Made] , ('Table'[Tackles Made] + 'Table'[Tackles Missed]) , 0)
, 4
) * 100
The table:
But (as always), there is a problem with calculating ratios using calculated columns as the single numbers (each row) be added in the total line, e.g. using a table visual. For this reason, I recommend to create a measure instead:
I use this DAX statement to create a measure (https://docs.microsoft.com/en-us/power-bi/transform-model/desktop-tutorial-create-measures😞
Measure =
AVERAGEX(
'Table'
, ROUND(
DIVIDE('Table'[Tackles Made] , 'Table'[Tackles Made] + 'Table'[Tackles Missed] , 0)
, 4) * 100
)
Using everything in a table visual makes the difference between calculated columns and measure apparent:
Hopefully, this provides what you are looking for.
Regards,
Tom
| User | Count |
|---|---|
| 56 | |
| 42 | |
| 30 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 71 | |
| 59 | |
| 39 | |
| 22 | |
| 22 |