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
Anonymous
Not applicable

Color code Products on a scatter plot Based on Profit and Quantity Sold

 

Hi All,

 

I have a scatter plot of Products. The scatter plot has the axis Profitability Vs Popularity (No of Items Sold). Initial dataset is in the following format.

 

Date, Product, Profit ,ItemsSold

2017-01-01,AA,500,30

2017-01-02,AA,400,20

2017-01-01,BB,600,20

2017-01-06,BB,700,40

2017-02-19,CC,1000,90

2017-02-20,CC,1500,95

2017-02-21,CC,2000,105

 and so on.  

 

Then i plot the products on the scatter plot. where X-axis=Sum[Profit] Y-axis=Sum[ItemsSold]

 

Then i am creating following measures to group the products.

 

TotalProfit = SUM(PRICE_LEVEL[Profit])

AllProfit = CALCULATE(SUM(PRICE_LEVEL[Profit]),ALLSELECTED(PRICE_LEVEL[Product]))

Profitability Margin = CALCULATE(DIVIDE([TotalProfit],[TotalPortionsSold]),ALLSELECTED(PRICE_LEVEL))

 

TotalPortionsSold = SUM(PRICE_LEVEL[ItemsSold])

AllPortionsSold = CALCULATE(SUM(PRICE_LEVEL[ItemsSold]),ALLSELECTED(PRICE_LEVEL[Product]))

NumberofMaterial = CALCULATE(DISTINCTCOUNT(PRICE_LEVEL[MATERIAL]),ALLSELECTED(PRICE_LEVEL))

Popularity Margin = CALCULATE(DIVIDE([TotalPortionsSold],[NumberofMaterial])*0.7,ALLSELECTED(PRICE_LEVEL))

 

Then I categorize Products as high and Low Profitable and Popular as follows.

 

Profitabilty = if([TotalProfit]< [Profitability Margin],"L","H")

Popularity = if([TotalPortionsSold]<[Popularity Margin],"L","H")

 

Then Based on H and L combinations I give names to those categories. Basically i need to divide products in to four categories. I have done it using following measure.

 

Quadrant = CALCULATE(if([Profitabilty]="H" && [Popularity]="H","Q1",if([Profitabilty]="H" && [Popularity]="L","Q2",if([Profitabilty]="L" && [Popularity]="H","Q3","Q4"))))

 

Now i need to color code the scatter plot based on the above quadrant. 

My question is i cannot add [Quadrant] to the legend as it is a measure. 

Does any one of you know how can i achieve this? 

 

Regards,

Maddy

 

 

 

 

 

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous,

 

Current scatter visual not support color code and use measure as legend, I'd like to suggest you submit this to ideas.

 

BTW, your formula contains calculation which based on visual filter, so it is impossible to convert them to calculate column.

 

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

@Anonymous

 

Thanks for the reply.

 

I perform the calculations on aggredated data. That is why i cannot create calculated columns.

 

Regards,

Maddy

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