cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
maddy Member
Member

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
Community Support Team
Community Support Team

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

Hi @maddy,

 

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 Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
maddy Member
Member

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

@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
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 102 members 1,489 guests
Please welcome our newest community members: