Forum Discussion
Bar Chart with multiple bars plotted from separate columns
I have a sample table below which looks like this:
ID#Test1Test2
1 | 1 | 0 | |
| 2 | 0 | 0 | |
| 3 | 0 | 0 | |
| 4 | 0 | 0 | |
| 5 | 0 | 0 | |
| 6 | 0 | 1 | |
| 7 | 1 | 1 | |
| 8 | 1 | 0 | |
| 9 | 1 | 0 | |
| 10 | 0 | 0 | |
| 11 | 1 | 1 | |
| 12 | 1 | 0 | |
| 13 | 0 | 0 | |
| 14 | 0 | 1 | |
| 15 | 1 | 1 |
I am looking to create a bar chart that would show the number of 1s in test 1 and test 2, I also need to display (ideally stacked/clustered) the number of positive results for test 2 where test 1 is negative. So the x axis of the chart would show Test1, Test2, with 3 bars; the values would be the count of test1 column, count of test 2, count of test 2 where test 1 is 0. I can make all these columns in my table without issue, i cannot plot each column together on one plot- PBi seems to plot all combinations of the columns along the x axis when i try to add them all to a bar chart:
(my acutal table has some blanks)
- Anonymous3 years ago
Hi Anonymous ,
1. Unpivot the [test 1] and [test 2] in powerquery editor.
2. the please create 3 measures.
count = DISTINCTCOUNT('Table'[ID#])number of 1s = CALCULATE(DISTINCTCOUNT('Table'[ID#]), 'Table'[Value] = 1)count of test 2 where test 1 is 0 = CALCULATE( DISTINCTCOUNT( 'Table'[ID#]),'Table'[Attribute] = "Test1" && 'Table'[Value] = 1 )result.
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
1 Reply
- AnonymousNot applicable
Hi Anonymous ,
1. Unpivot the [test 1] and [test 2] in powerquery editor.
2. the please create 3 measures.
count = DISTINCTCOUNT('Table'[ID#])number of 1s = CALCULATE(DISTINCTCOUNT('Table'[ID#]), 'Table'[Value] = 1)count of test 2 where test 1 is 0 = CALCULATE( DISTINCTCOUNT( 'Table'[ID#]),'Table'[Attribute] = "Test1" && 'Table'[Value] = 1 )result.
Best Regards,
Gao
Community Support TeamIf there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum