Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tina345
Helper II
Helper II

Pie 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?

2 ACCEPTED SOLUTIONS
DataZoe
Employee
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 page
3. 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)"
 
DataZoe_2-1623947120093.png

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

View solution in original post

Thanks DataZoe ..I was able to create a chart.

View solution in original post

2 REPLIES 2
DataZoe
Employee
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 page
3. 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)"
 
DataZoe_2-1623947120093.png

 

Respectfully,
Zoe Douglas (DataZoe)



Follow me on LinkedIn at https://www.linkedin.com/in/zoedouglas-data
See my reports and blog at https://www.datazoepowerbi.com/

Thanks DataZoe ..I was able to create a chart.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.