Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Add new filter outside ALLEXCEPT

Hi,    I am trying to calculate a 'share of trade' metric where the 'Total Market Sales' exists within my table. My example table looks like this: I want to determine the following:  Shop A's sha...
  • v-robertq-msft's avatar
    5 years ago

    Hi, Anonymous 

    According to your description and sample data, I can roughly understand your requirement, I think you can try this measure:

     

    Share of Trade =
    VAR _TotalMarketSales =
        CALCULATE (
            SUM ( 'Table'[Sales] ),
            FILTER (
                ALL ( 'Table' ),
                [Category] = MAX ( 'Table'[Category] )
                    && [Market] = "Total Market"
            )
        )
    RETURN
    DIVIDE ( SUM ( 'Table'[Sales] ), _TotalMarketSales )

     

     

    You can set the measure format to "Percentage" like this:

     

    Then you can create a table chart and place and set the visual like this to get your expected output:

     

    And you can get what you want.

    You can download my test pbix file below

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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