Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

DAX percentages

I'm relatively new to DAX and stuck on a particular problem. I would like to build a line chart that shows the percentage of market share of all my products for each month. I have include filters on the page for Country, Divison, Product Line and Month.

 

I need to calculate the percentage of market share by dividing (revenue/market size); however I do not know how to add that to the whole formula with the filters. (The whole market are the three countries)

 

It would need to dynamically recalculate with the context of the filter so that only data after the filter is included. And when no filter is selected then I have the total market share of our market.

I have tried various CALCULATE, SUMX, Calculated Table functions with little success.

Sample data is below and any help is very much appreciated, I know tha market share column should be calculated in power bi

Thank YOU

 

CountryDivisionProduct Line Market Size Revenue Market Share
MexicoDental Red100.0050.0050%
MexicoDentalGreen

95.00

45.0047%
Mexico CosmeticsYellow125.00100.0080%
MexicoCosmeticsPink70.0030.0042%
ArgentinaDentalRed50.0010.0020%
ArgentinaDentalGreen45.005.0011%
ArgentinaCosmeticsYellow80.0045.0056%
ArgentinaCosmeticsPink70.005.007%
USADentalRed200.00150.0075%
USADentalGreen130.0085.0065%
USACosmeticsYellow250.00200.0080%
USACosmeticsPink140.00100.0071%

 

 

2 Replies

  • tamerj1's avatar
    tamerj1
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous 

    For the denominator you can use something like

    CALCULATE ( SUM ( 'Table'[Revenue] ), REMOVEFILTERS ( ) )

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    According to your statement, I think there should lost [Month] column in your sample data. And I need to know the calculate logic about Revenue and Market Size. Will you determind the Market Size each month in your table? And will you need to sum the revenue each month? I think you can try ALLEXCEPT FUNCTION if you want your measure can be filtered by Filter or Slicers.

    Please share a sample file without sensitive data with us and show me the result you want. This will make me easier to find the solution.

     

    Best Regards,
    Rico Zhou

     

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