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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
AnkitaaMishra
Super User
Super User

DAX Help to calculate Percentage for Pie Chart

Hi,

 

I am trying to visualize % of Product Performance using a Pie Chart and below is the sample data.

IDProduct NameTie %Product %
100A9.6840.32258
100B9.6850
101C5.431.48714
101D5.463.11385
102E8.0645.16129
102F8.0646.77419
103A3.9229.8287
103B3.9266.25337
104C1045
104D1045
105E9.180.17398
105F9.110.7304
106A1.6944.90657
106B1.6953.40113

 

So for each ID, I am trying to plot Product % but its not summing up to 100%. 
for example : if i consider ID = 100 then for product A and B, the Product % is 40.32258%+50% = 90.32258%. 

Now if i add the Tie % column to above calculation then it 90.32258%+9.68% = 100%. 
I cannot use both the columns in Values field of Pie Chart.
The expected output is given below : 

ankita_mishra_9_0-1720605884927.png


How can I achieve this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Thank you for your prompt reply! @amitchandak

Hi @AnkitaaMishra 

Based on your screenshot, your table structure should look like this:

vjialongymsft_0-1720684623914.png


If you don't want to change your table structure, I can offer you a workaround, but it won't fully meet your needs.

 

First, create an index column in power query.

 

Then, create a measure by using the following DAX:

Changed Tie % = 
VAR _ID = SELECTEDVALUE('Table'[ID])
VAR _index = SELECTEDVALUE('Table'[Index])
RETURN
IF(CALCULATE(SELECTEDVALUE('Table'[Tie %]),FILTER(ALL('Table'),'Table'[ID]=_ID&&'Table'[Index]=_index-1))<>BLANK(),BLANK(),SELECTEDVALUE('Table'[Tie %]))

 

 

Place the corresponding fields in the pie chart:

vjialongymsft_2-1720684986480.png


Result:

vjialongymsft_3-1720685011759.png

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

 

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Thank you for your prompt reply! @amitchandak

Hi @AnkitaaMishra 

Based on your screenshot, your table structure should look like this:

vjialongymsft_0-1720684623914.png


If you don't want to change your table structure, I can offer you a workaround, but it won't fully meet your needs.

 

First, create an index column in power query.

 

Then, create a measure by using the following DAX:

Changed Tie % = 
VAR _ID = SELECTEDVALUE('Table'[ID])
VAR _index = SELECTEDVALUE('Table'[Index])
RETURN
IF(CALCULATE(SELECTEDVALUE('Table'[Tie %]),FILTER(ALL('Table'),'Table'[ID]=_ID&&'Table'[Index]=_index-1))<>BLANK(),BLANK(),SELECTEDVALUE('Table'[Tie %]))

 

 

Place the corresponding fields in the pie chart:

vjialongymsft_2-1720684986480.png


Result:

vjialongymsft_3-1720685011759.png

 

 

 

 

 

 

Best Regards,

Jayleny

 

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

 

 

 

hi @Anonymous ,

Thanks for your response! this workaround works for me.🙂

amitchandak
Super User
Super User

@AnkitaaMishra , Have three measures and use them in pir with no legend Assuming Product % and Tie% are measures

 

A= calculate([Product %], filter(Table, Table[Product Name] = "A") )

 

B= calculate([Product %], filter(Table, Table[Product Name] = "B") )

 

Then use Tie % as thrid Meausre

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak , 

Thanks for your response!
the products are different for each ID, so how can below part execute dynamically : 
filter(Table, Table[Product Name] = "A")
also, the legend is needed to know which product are involved in the ID.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.