Forum Discussion
Calculate Marketshare - Help
Hi. I need some help building a table with marketshare values.
So, imagine I have this table:
| Year-Month | Brand | Value |
| Jan'21 | A | 45 |
| Jan'21 | B | 35 |
| Jan'21 | A | 76 |
| Jan'21 | C | 465 |
| Jan'21 | B | 4564 |
| Feb'21 | B | 363 |
| Feb'21 | B | 4646 |
| Feb'21 | C | 564 |
| Feb'21 | C | 6456 |
| Feb'21 | A | 346 |
| Mar'21 | C | 36345 |
| Mar'21 | A | 363 |
| Mar'21 | B | 6546 |
| Mar'21 | C | 3456 |
| Mar'21 | A | 353 |
And I want to calculate the marketshare of each brand in each month.
The end result needs to be something like this:
| Year-Month | Brand | Value |
| Jan'21 | A | 0.023336548 |
| Jan'21 | B | 0.886981678 |
| Jan'21 | C | 0.089681774 |
| Feb'21 | A | 0.027959596 |
| Feb'21 | B | 0.404767677 |
| Feb'21 | C | 0.567272727 |
| Mar'21 | A | 0.01521365 |
| Mar'21 | B | 0.139090156 |
| Mar'21 | C | 0.845696194 |
To get this values, I calculated on excel as you can see in this image here . The final table is the red circled one. And I also putted the formulas I used.
This is to have a table with the values to build a line chart. I tried to put the vields and use "Percentage of Grand Total" with my real values, and it was not working.
Hope you can help me!
Hi, GoncaloCare
Please check the below picture and the sample pbix file's link down below.
Percentage by month =
IF (
ISFILTERED ( 'Calendar'[Year-Month] ),
DIVIDE (
SUM ( Data[Value] ),
CALCULATE ( SUM ( Data[Value] ), ALLSELECTED ( Brands[Brand] ) )
)
)https://www.dropbox.com/s/czwzog2rny4zypo/goncalocarre.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
11 Replies
- amitchandakSuper User
GoncaloCare , Try a measure like
divide(sum(Table[Value]), calculate(sum(Table[Value]), filter(allselected(Table),Table[Year-Month] = max(Table[Year-Month]))))
or
divide(sum(Table[Value]), calculate(sum(Table[Value]), removefilters(Table[Brand])))
- GoncaloCareHelper I
Hi! Thank you very much! I will try that solution, and If I need any assistance, I'll reply again. Thanks!
- Jihwan_KimSuper User
Hi, GoncaloCare
Please check the below picture and the sample pbix file's link down below.
Percentage by month =
IF (
ISFILTERED ( 'Calendar'[Year-Month] ),
DIVIDE (
SUM ( Data[Value] ),
CALCULATE ( SUM ( Data[Value] ), ALLSELECTED ( Brands[Brand] ) )
)
)https://www.dropbox.com/s/czwzog2rny4zypo/goncalocarre.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
- GoncaloCareHelper I
Hi! I will for sure try your solution! I'll reply again If I need any assistance! Thank you very much!
- GoncaloCareHelper I
Hi again Jihwan_Kim !
So, it's working great!
I have a question. In the line chart, I have 188 Brands, but only like 30/50 are showing. Do you know why that is happening? is that a limitation?
Thanks!
- Jihwan_KimSuper User
Hi, GoncaloCare
Thank you for your feedback.
I am not sure about how is the limitation of showing how many categories (or legends) in a linechart.
I also sometimes face a similar situation as what you just described.
However, if I see over 20 lines in one line chart, I don't think it creates values or insights for readers. Or, perhaps you can try to select other visualizations, like a scatter chart for instance, if you need to show more than 20~30 categories.
Thank you.