Forum Discussion

Migscruz's avatar
Migscruz
Helper I
5 years ago
Solved

Help with comparing all products

Hi!!!, i have a database (link: https://we.tl/t-QHZGDjbHgh ) and i would like to do all the posible comparisons of prices between Product X (i should be able to select the product i would like to com...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Migscruz 
    You have many alternatives , but I guess the following report structure best matches your requirement. Check the pbix for detail.

     

    1. Create 2 separate tables as slicers

    Name Table = DISTINCT('Table'[Name])
    Banner Table = DISTINCT('Table'[Banner])
     
    2. Create 2 measures to compare the average price
    product compare =
    var selectedproduct = CALCULATE(SUM([ Average Price ]),FILTER(ALLSELECTED('Table'),[Name]=SELECTEDVALUE('Name Table'[Name])))
    Return selectedproduct-SUM('Table'[ Average Price ])
     
    banner  compare =
    var selectedbanner =CALCULATE(SUM([ Average Price ]),FILTER(ALLSELECTED('Table'),[Banner]=SELECTEDVALUE('Banner Table'[Banner])))
    var rest_product = CALCULATE(SUM([ Average Price ]),FILTER(ALLSELECTED('Table'),[Banner]<>SELECTEDVALUE('Banner Table'[Banner])))
    Return selectedbanner - rest_product
     

     

     

    Paul Zheng _ Community Support Team
    If this post helps, please Accept it as the solution to help the other members find it more quickly.