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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

@v-shex-msft

 

Thanks for the reply.

 

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

 

Regards,

Maddy

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors