Forum Discussion

Br1-981's avatar
Br1-981
Helper I
2 years ago
Solved

Filtering on calculated measure

Hi,

I have a created a report where I have 2 main tables (to simpilify) SALES and COSTS where the main entity for both is "BRAND":

To connect the two I have a created a custom table:

UNIQUE_BRAND = DISTINCT(SALES[BRAND])

 

Then I have created 2 calculated measures:

MYCOMPANY_SALES = CALCULATE(SUM(SALES[SALES]), SALES[BRAND]="MY COMPANY")

MARKET_SALES = SUM(SALES[SALES])

 

Because my target is to create a graph like this to compare MY COMPANY SALES vs MARKET SALES:

This is working fine, issues come when I add a filter using the UNIQUE_BRAND[BRAND] I've created because I want to use it to create a subset of the market and compare MYCOMPANY vs One of more BRANDS:

 

I built the UNIQUE_BRAND table since I want to the same using the COSTS table so I cannot filter directly on one table, how should I build my meausres to avoid that they got filterd correctly?

Attached there is also the PBIX: https://we.tl/t-CZ8raGjpW2

 

Thanks in advance for the help!

 

Thanks

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Br1-981 

     

    Change the formula for your MYCOMPANY_SALES to :

    MYCOMPANY_SALES = CALCULATE(SUM(SALES[SALES]), UNIQUE_BRAND[BRAND]="MY COMPANY")

     

     

    This is the result you want

     

     

     

     

     

     

    Best Regards,

    Jayleny

     

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

     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Br1-981 

     

    Change the formula for your MYCOMPANY_SALES to :

    MYCOMPANY_SALES = CALCULATE(SUM(SALES[SALES]), UNIQUE_BRAND[BRAND]="MY COMPANY")

     

     

    This is the result you want

     

     

     

     

     

     

    Best Regards,

    Jayleny

     

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