Forum Discussion
Calculate % based off total, rather than selected
I should warn you first off - I'm new - only been using Power BI for Desktop for 2 days, so still trying to understand everything. I have target date though coming up that I need to build several reports and quickly.
This is a basic layout of data to help explain what I'm attempting to do.
Table1
ColumnA Result Month
Random# Good Feb
Random# Good Jan
Random# Bad Jan
Random# Unknown Jan
Random# Good Jan
Random# Good Jan
Random# Unknown Jan
Random# Unknown Feb
Random# Unknown Jan
Random# Good Jan
Random# Good Feb
Random# Good Jan
Random# Bad Jan
Random# Good Feb
Random# Good Jan
Random# Bad Jan
I want a line chart, that has 2 lines - One for Good by Month, other for Bad by Month. I've filtered out the Unknowns. The values is %GT Count of Random#. I want the Percentage to be representative of all the rows (Good, Bad, Unknown), but - I only want to show Good and Bad on the line chart. Once I filter out Unknown, the percentages shift to be reflective as if there are the only options Good and Bad.
So - I want Good / Good + Bad + unknown but it is calculating based on Good / Good + Bad
I saw several answers similar to this, but I can't seem to get them working - and with my limited knowledge so far, its a struggle. I have watched almost all of the videos on the Guided Learning.
11 Replies
- vitinho
Helper I
Hi!
Fisrt thing you can create a new measure like:
Total = COUNTROWS('Tabela2')Then you can calculate the percentages
%Good = COUNTX(FILTER('Tabela2';
'Tabela2'[Result]="Good");
'Tabela2'[Result]) / [Total]Try this and see if works
- Lenihan
Helper III
Hi vitinho,
Thank you for the quick reply
The percentage calculation (2nd part) - where would I enter that? Is that a new measure, or how would I get that formula on my visual?
also - tabela2 - was that table1 then, or was I supposed to create a new table?
- vitinho
Helper I
Table 2 is the same as your table 1, my bad.
The second step has to be a New Column, in my example named as %Good