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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Compare Units Sold of 2 items in Scatter Plot, Select 2 items using slicers to plot

Hi everyone, 

 

I am trying to provide my users with the option to select 2 items (using 2 different slicers), and display a scatter plot of the units sold for those 2 items. 


Here is what I have so far: 

 

Item 1 Units = CALCULATE(SUM(table[units]), FILTER(ALL(table),SELECTEDVALUE(table[Item_ID])))
Item 1 Units = CALCULATE(SUM(table[units]), FILTER(ALL(table),SELECTEDVALUE(table[Item_ID_duplicate])))
 
As you can see, I have duplicated the item ID to place in 2 different slicers. I want to show whether the 2 selected items have a correlation in units sold or not. 
 
However, the scatter chart returns a blank graph. Please let me know how to proceed, truly appreciate your help - thanks!
1 ACCEPTED SOLUTION
v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Do you want to compare item1 and item2 like this?

 

CO1.jpg

 

If yes, we can use the following steps to meet your requirement.

 

1. Create a slicer table.

 

Slicer 1 = VALUES('Table'[Item_ID])

 

CO2.jpg

 

2. Create a measure, then put the new table’s Item_ID column in Legend.

 

Item 1 Units = 
var _select = SELECTEDVALUE('Slicer 1'[Item_ID])
return
CALCULATE(SUM('Table'[units]), FILTER('Table','Table'[Item_ID]=_select))

 

Co3.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi, 

 

Thanks for your help! However, you have placed 'x' and 'y' column in the 'X axis' and 'Y axis' field of the visual. I do not have x and y column. I have the 'date' column and 'Item ID' and 'units' 

 

Example:

 

Date  Item  Units

1 Jan   A      5000

2 Jan   A       65

3 Jan   A       677

1 Jan   B        12

2 Jan   B        345 

3 Jan   B       30

 

Are you able to show me how to work with something like that? Thanks again for your help!

 

v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

How about the result after you follow the suggestions mentioned in my original post?

Could you please provide more details or expected result about it If it doesn't meet your requirement?

If you've fixed the issue on your own please kindly share your solution. If the above posts help, please kindly mark it as a solution to help others find it more quickly.

 

Best regards,

 

Community Support Team _ zhenbw

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

v-zhenbw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Do you want to compare item1 and item2 like this?

 

CO1.jpg

 

If yes, we can use the following steps to meet your requirement.

 

1. Create a slicer table.

 

Slicer 1 = VALUES('Table'[Item_ID])

 

CO2.jpg

 

2. Create a measure, then put the new table’s Item_ID column in Legend.

 

Item 1 Units = 
var _select = SELECTEDVALUE('Slicer 1'[Item_ID])
return
CALCULATE(SUM('Table'[units]), FILTER('Table','Table'[Item_ID]=_select))

 

Co3.jpg

 

If it doesn’t meet your requirement, could you please provide a mockup sample based on fake data?

It will be helpful if you can show us the exact expected result based on the tables.

 

Please upload your files to OneDrive For Business and share the link here. Please don't contain any Confidential Information or Real data in your reply.

 

Best regards,

 

Community Support Team _ zhenbw

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

 

BTW, pbix as attached.

amitchandak
Super User
Super User

@Anonymous , They should come from two different tables or the column in the same table. the column in the same table might not work.

 

refer an example for date - https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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