Forum Discussion

AlwaysBI's avatar
AlwaysBI
Frequent Visitor
7 years ago
Solved

AllExcept and filter

HI

 

I need some help.

I have a table below.

YearMonthDayProductTypeGroupPrice
201931AOwnFirst Group A100
201931BCompetitorFirst Group A120
201931COwnFirst Group B90
201931DCompetitorFirst Group B80
201935EOwnFirst Group C150
201935FCompetitorFirst Group C170
201937GOwnFirst Group D150
201937HCompetitorFirst Group D120

 

and I would like to show the competitor price in every group itself.

Below is the measure I use and the expected result that I want to archive. Please advise.

 

CompetitorPricebyGroup =
CALCULATE(AVERAGE('Table'[price]),FILTER(ALLEXCEPT('Table','Table'[Day],'Table'[Month],'Table'[Group]),'Table'[Type]= "Competitor"),ALL('Table'))
 
Expected Result
YearMonthDayProductTypeGroupPriceCompetitor Price
201931AOwnFirst Group A100120
201931BCompetitorFirst Group A120120
201931COwnFirst Group B9080
201931DCompetitorFirst Group B8080
201935EOwnFirst Group C150170
201935FCompetitorFirst Group C170170
201937GOwnFirst Group D150120
201937HCompetitorFirst Group D120120

 

  • Hi AlwaysBI 

    You can create a calculated colum in the table you show (Table1):

     

    Competitor Price =
    CALCULATE (
        DISTINCT ( Table1[Price] );
        ALLEXCEPT ( Table1; Table1[Group] );
        Table1[Type] = "Competitor"
    )

1 Reply

  • AlB's avatar
    AlB
    Community Champion

    Hi AlwaysBI 

    You can create a calculated colum in the table you show (Table1):

     

    Competitor Price =
    CALCULATE (
        DISTINCT ( Table1[Price] );
        ALLEXCEPT ( Table1; Table1[Group] );
        Table1[Type] = "Competitor"
    )