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
Mahadevaraobc
Helper II
Helper II

Compare 2 product info in single visual

Hi Experts,

 

require your help on achiveing the following,

 

Compare 2 products in different slicers

ex: Product A in 1st slicer and Product B in 2nd Slicer and its values should be shown in line chart.

Both Products will be in same column.

 

 

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Mahadevaraobc 

 

If you want to compare two products' values in a line chart, you can put product column in Legend box. As a result, each product will be shown as a line. You just need one slicer to pick which products to shown on it. 

21111701.jpg

 

If you want to use two slicers, you could add two product tables which only contain product column. Then create two measures to calculate the value based on selected products in slicers. Use these two measures as Values field and no Legend field is needed. 

Sales Product 1 = CALCULATE(SUM('Table'[Sales]),'Table'[Product]=SELECTEDVALUE(ProductTable[Product]))
Sales Product 2 = CALCULATE(SUM('Table'[Sales]),'Table'[Product]=SELECTEDVALUE('ProductTable 2'[Product]))

21111702.jpg

See page 1 and page 2 in the attached pbix. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @Mahadevaraobc 

 

If you want to compare two products' values in a line chart, you can put product column in Legend box. As a result, each product will be shown as a line. You just need one slicer to pick which products to shown on it. 

21111701.jpg

 

If you want to use two slicers, you could add two product tables which only contain product column. Then create two measures to calculate the value based on selected products in slicers. Use these two measures as Values field and no Legend field is needed. 

Sales Product 1 = CALCULATE(SUM('Table'[Sales]),'Table'[Product]=SELECTEDVALUE(ProductTable[Product]))
Sales Product 2 = CALCULATE(SUM('Table'[Sales]),'Table'[Product]=SELECTEDVALUE('ProductTable 2'[Product]))

21111702.jpg

See page 1 and page 2 in the attached pbix. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

MFelix
Super User
Super User

Hi @Mahadevaraobc ,

 

First of all if you are using the same column to make two separate slicers you can have issues on the filtering of the visualizations because one slicer will overstep the other one so you will not get results from one of the slicers, in this case best option is to have it on a single slicer or making use of a disconnected table.

 

Regarding the question about the difference in values you can do it by using the following measure:

 

Difference = CALCULATE(SUM('Table'[Value]), 'Table'[Item] = Max('Table'[Item]))- CALCULATE(SUM('Table'[Value]), 'Table'[Item] = MIN('Table'[Item]))

 

MFelix_0-1637000587949.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.