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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
carlosDash
Advocate V
Advocate V

How do I create a pie chart from a single column of data?

I have a column in a CSV-file with about 60 e-mail addresses of which maybe 45 are valid addresses, five have the value NULL and the rest are empty rows. I want to display the column as a pie chart in the following way: one slice for the valid addresses, one slice for the NULL ones and another slice for the empty rows. Is this possible and if so, how would I go about doing it? Or do I always need two columns for a pie chart? Sorry if this is a bad question, I'm new to Power BI.

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

In this case, we can create another custom field using DAX and use that as legend. here is the sample:

 

Sample Data:

 

email1.PNG

 

Output:

 

email2.PNG

 

DAX Formula for new field:

 

EmailGroup = if(Table1[Email]=BLANK(),"Blank Email", if(Table1[Email]="NULL", "Email is Null", if(IFERROR(SEARCH("@",Table1[Email]),-1)=-1,"InValid Email", "Valid Email")))

 

We can always change that formula on business need, it is just an example.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

In this case, we can create another custom field using DAX and use that as legend. here is the sample:

 

Sample Data:

 

email1.PNG

 

Output:

 

email2.PNG

 

DAX Formula for new field:

 

EmailGroup = if(Table1[Email]=BLANK(),"Blank Email", if(Table1[Email]="NULL", "Email is Null", if(IFERROR(SEARCH("@",Table1[Email]),-1)=-1,"InValid Email", "Valid Email")))

 

We can always change that formula on business need, it is just an example.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Fantastic! This did the trick, thank you very much for taking the time to write everything in such detail Heart. I had a little bit of trouble with the value separators (you used comma, but apparently due to localization I needed to use semicolon instead), but it works.

Thanks for the feedback and good to know it is working for you. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

PavelR
Solution Specialist
Solution Specialist

In this case you need two columns. In the second column you need to solve if the value is valid, so create calculated column and define condition when the value is valid (for example when text of value contains "@" then Valid, when value equals NULL then NULL, when empty then Empty etc.). Than you use count of first column as Values in visual, and second column as Legend.

 

Regards.

Pavel

PavelR
Solution Specialist
Solution Specialist

Or you can use "New group" function on column which is in the Legend area in visual and create manually different groups for values. Butit is quite a lot of work, when you have large dataset.

 

Group.png

 

Regards.

Pavel

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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