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
Migscruz
Helper I
Helper I

Comparing price of different products in the same table based on filters

Hello everyone,

 

I'm trying to compare the price of different products that are on the same table with the possibility of being able to choose the products that I want to compare (Example: A vs B, A vs C, A vs D, etc). I have tried in two ways that u can see in my pbi file but the filters/selector aren't working properly. In example 1, when i choose the product that i would like to compare (filter 2) the name of the products dissappear in the main table. In example 2, when i choose the product in selector 2, the measure doesn't work because it should be price of product 1 - price of product 2 and it doesn't work when i use the selector 2. I'm attaching the files here  (database and PBI File) : https://www.transferxl.com/00ZDwD8RZmtMX     . Hope u can help me.

 

Thanks!

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @Migscruz,

 

You should also create a dimension table to store 'Product 2'.

And then create two measure as:

Product1 price = 
CALCULATE(
    MAX('Table'[ Average Price ]),
    FILTER(
        'Table',
        'Table'[Name]=ALLSELECTED('Product 1'[Name])
    )
)
Product2 price = 
CALCULATE(
    MAX('Table'[ Average Price ]),
    FILTER(
        'Table',
        'Table'[Name]=ALLSELECTED('Product 2'[Name])
    )
)

Here is the output:

vxulinmstf_0-1629444755764.png

Or you can try this:

vxulinmstf_1-1629444782544.png

Both of the output are contained in the attached demo, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

View solution in original post

1 REPLY 1
v-xulin-mstf
Community Support
Community Support

Hi @Migscruz,

 

You should also create a dimension table to store 'Product 2'.

And then create two measure as:

Product1 price = 
CALCULATE(
    MAX('Table'[ Average Price ]),
    FILTER(
        'Table',
        'Table'[Name]=ALLSELECTED('Product 1'[Name])
    )
)
Product2 price = 
CALCULATE(
    MAX('Table'[ Average Price ]),
    FILTER(
        'Table',
        'Table'[Name]=ALLSELECTED('Product 2'[Name])
    )
)

Here is the output:

vxulinmstf_0-1629444755764.png

Or you can try this:

vxulinmstf_1-1629444782544.png

Both of the output are contained in the attached demo, please try it.

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

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.