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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Stuart95051
New Member

How to build a visual with these requirements?

Let's say I've data like this:

 

 SweetSour/TartUmamiSpicyBitterVegan
Sweet n Sour Pork111   
Mapo Tofu1 11  
Sushi  1   
Soy Burger  1  1
Lagsane111   
Apple Pie1     

 

I want to build a visual to show % of my menu which has the Sweet characteristics, % of my menu which has the Sour characteristics, % of my menu which has the Umami characteristics, and so on an so forth.  It's easy to do this in Excel, I'd first need to count the number of items in my menu.  How do I do the same in PowerBi so that it can be used to calculate the % later?  

 

Thanks!

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @Stuart95051 ,

I create a table as you mentioned and I think you can let Bitter column become 0.

vyilongmsft_0-1730872993544.png

Then I think you can create six measures and here is a common template for these measures, you can change their respective names as needed.

SweetPercent =
DIVIDE (
    CALCULATE ( COUNTROWS ( 'Table' ), VALUE ( 'Table'[Sweet] ) = 1 ),
    COUNTROWS ( 'Table' )
)

vyilongmsft_1-1730873343041.pngvyilongmsft_2-1730873356210.png

Finally you can put them into pie visual and it will give you what you want.

vyilongmsft_3-1730873449128.png

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yilong-msft
Community Support
Community Support

Hi @Stuart95051 ,

I create a table as you mentioned and I think you can let Bitter column become 0.

vyilongmsft_0-1730872993544.png

Then I think you can create six measures and here is a common template for these measures, you can change their respective names as needed.

SweetPercent =
DIVIDE (
    CALCULATE ( COUNTROWS ( 'Table' ), VALUE ( 'Table'[Sweet] ) = 1 ),
    COUNTROWS ( 'Table' )
)

vyilongmsft_1-1730873343041.pngvyilongmsft_2-1730873356210.png

Finally you can put them into pie visual and it will give you what you want.

vyilongmsft_3-1730873449128.png

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Rupak_bi
Post Prodigy
Post Prodigy

Hi @Stuart95051 

 

Just unpivot all columns except the first one from power query. 

Rupak_bi_0-1730800318943.png

 



Regards
Rupak
FOLLOW ME : https://www.linkedin.com/in/rupaksar/

Thanks for the idea!  My horizontal totals and vertical totals are all 100%.  I think it has something to do with my data type (integer).  Let me convert them to true/false and see what happens.  

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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