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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
aryan
Helper I
Helper I

Creation of pie chart based on conditions

Hi everyone

i have to create a pie with 'S' column ,that pie chart should ivide into 3 types based on 'P' column in the same table,Now i need to filter the Stock value in pie chart as L as one colour C as one cololur,remaining as one colour in percentage

Pie.JPGPie excel.JPG

Thanks in advance,

Best wishes

Aryan

5 REPLIES 5
v-qiuyu-msft
Community Support
Community Support

Hi @aryan,

 

Based on my understanding, you would like to divide P column to three type, L, C and other colors which are not equal to L or C, then calculate their percentage of grand total, right? 

 

You can create a calculated column, 

 

Type = IF('Table4'[P]<>"L" && 'Table4'[P]<>"C","other",'Table4'[P])

 

Then grad this column to pie chart visual Legend bucket, column S to Values bucket. 

 

q2.PNG

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you for the reply i am seeing an error in the formulaError.JPG

Hi @aryan,

 

It looks like the [Stock Value] data type is Number. You need to format [Stock Value] as string then compare them with text "MSC024" and "MSC025":

 

Type=If(FORMAT('Filtered'[Stock Value],"General Number")<>"MSC024" && FORMAT('Filtered'[Stock Value],"General Number")<>"MSC025","other",'Filtered'[Stock Value])

 

Reference:

https://msdn.microsoft.com/en-us/query-bi/dax/format-function-dax

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I have tried that but it is showing error as expressions that yeild variant data type can't be used to define calculated column

After changing the data type of stock value to text the output is not as desired

Hi @aryan,

 

Please share pbix file and points out where the issue is. 

 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors