Forum Discussion
tina345
Helper II
5 years agoPie Chart with distinct column value
Hello All,
I am new to power BI and trying to create a simple PI chart.
I am trying to create a Pie Chart between ID and Distinct Category.Some category are nulls and would like to represent as unknown.
Data is like:
id, category
100,A
200,A
300,B
400,B
500,null
Could you please help?
Hi tina345 ,
You can try these steps:
1. Create a column to reclassify the null to Unknown, by right-clicking the Table and choosing "New column" and using this DAX expression:
New Category = if(len([Category])=0,"Unknown",[Category])which simply says if it's blank (or null) then have it be Unknown, otherwise use the category.2. Add a pie chart to the page3. Add the "New Category" to the Legend and the "ID" to the Values section.4. The IDs might try to sum instead of doing a count, so to change that, click the drop down next to ID and choose "Count (Distinct)"Thanks DataZoe ..I was able to create a chart.
2 Replies
- DataZoe
Microsoft Employee
Hi tina345 ,
You can try these steps:
1. Create a column to reclassify the null to Unknown, by right-clicking the Table and choosing "New column" and using this DAX expression:
New Category = if(len([Category])=0,"Unknown",[Category])which simply says if it's blank (or null) then have it be Unknown, otherwise use the category.2. Add a pie chart to the page3. Add the "New Category" to the Legend and the "ID" to the Values section.4. The IDs might try to sum instead of doing a count, so to change that, click the drop down next to ID and choose "Count (Distinct)"- tina345
Helper II
Thanks DataZoe ..I was able to create a chart.