Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Calculate Market Share in Matrix

Hi,

I have a matrix report that looks like the below.

 

I am trying to calculate the Market Share numbers here.

So in my BI I have 1 field for sales values and the field column of Market Set is what gives me Account or Remaining Market.

 

My Table Name is UPCData.

 

I tried to paste in a picture of my BI but this would not let me do it.

 

Any help?

 

 Market SetAccountAccountRemaining MarketRemaining MarketGrand Total
ItemSalesMarket ShareSalesMarket ShareSales
CHESTER'S CORN AND POTATO SNACK FLAMIN HOT FRIES BAG 5.25 OUNCE$305,67045.1%$371,52954.9%$677,199
LAY'S POTATO CHIP CLASSIC FLAT BAG 2.625 OUNCE$230,27035.8%$412,20564.2%$642,475
RUFFLES POTATO CHIP CHEDDAR AND SOUR CREAM RIDGED BAG 2.5 OUNCE$205,42836.6%$355,31063.4%$560,738
CHESTER'S CORN AND POTATO SNACK FLAMIN HOT FRIES BAG 3.625 OUNCE$270,15651.2%$257,09748.8%$527,253
SABRITAS RUFFLES POTATO CHIP CHEESE RIDGED BAG 2.5 OUNCE$184,19647.0%$208,04053.0%$392,236
RUFFLES POTATO CHIP CHEDDAR AND SOUR CREAM RIDGED BAG 8.5 OUNCE$99,09626.0%$281,74274.0%$380,838

11 Replies

  • v-cazheng-msft's avatar
    v-cazheng-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous 

    You can create a Measure to get the result you want.

     

    Market share =

    VAR total_item =

        CALCULATE ( SUM ( UPCData[Sales] ), ALLEXCEPT ( UPCData, UPCData[Item] ) )

    VAR total_market_set =

        CALCULATE ( SUM ( UPCData[Sales] ), ALLEXCEPT ( UPCData, UPCData[Market Set] ) )

    RETURN

        IF (

            HASONEVALUE ( UPCData[Item] ),

            IF (

                HASONEFILTER ( UPCData[Market Set] ),

                SELECTEDVALUE ( UPCData[Sales] ) / total_item,

                1

            ),

            total_market_set / total_item

        )

     

    The result looks like this:

     

     

    For more details, you can refer the attached pbix.

     

    Best Regards,

    Caiyun Zheng

     

    Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      v-cazheng-msft 

       

      Thank you very much...this works perfectly for the purposes of what I had posted.

       

      One thing I did not show is that I have additional filters from the same UPCDATA table for Geography, Category, Brand, Package Shape and Size. When I tried to start adding them to the HASONEFILTER line I got an error. Any help on how to make this work on all the filters on the page?