Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
GoncaloCare
Helper I
Helper I

Calculate Marketshare - Help

Hi. I need some help building a table with marketshare values.

So, imagine I have this table:

 

Year-MonthBrandValue
Jan'21A45
Jan'21B35
Jan'21A76
Jan'21C465
Jan'21B4564
Feb'21B363
Feb'21B4646
Feb'21C564
Feb'21C6456
Feb'21A346
Mar'21C36345
Mar'21A363
Mar'21B6546
Mar'21C3456
Mar'21A353

 

And I want to calculate the marketshare of each brand in each month.

The end result needs to be something like this:

Year-MonthBrandValue
Jan'21A0.023336548
Jan'21B0.886981678
Jan'21C0.089681774
Feb'21A0.027959596
Feb'21B0.404767677
Feb'21C0.567272727
Mar'21A0.01521365
Mar'21B0.139090156
Mar'21C0.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!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi, @GoncaloCare 

Please check the below picture and the sample pbix file's link down below.

 

Picture11.png

 

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.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

11 REPLIES 11
Jihwan_Kim
Super User
Super User

Hi, @GoncaloCare 

Please check the below picture and the sample pbix file's link down below.

 

Picture11.png

 

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.

 

Linkedin: https://www.linkedin.com/in/jihwankim1975/


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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!

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.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim 

Thank you very much again. Sadly, it doesn't show all brands. Do you know any way to group brands? For example, in the table I provided, grouping A and C to "Other" group. 

Is it possible?

 

 

Thanks!

Best Regards.

Hi, @GoncaloCare 

Thank you for your feedback.

If you just want to group those two, you can simply create a hierarchy table.

Or, do you want to dynamically group? For instance, below 50% goes to "Others", and shows the rest? This is also doable if you have a rule about how to group those.

If it is OK with you, please share your sample pbix file's link here, and give instructions about how to group. Then I can try to look into it to come up with a more accurate solution.

 

Thank you.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim 

Thanks again for your help! 

 

I would love it would be possible to dynamically group. Like, if it's above 1% MS, group into "Others. 

I'm sending the raw data (I changed the names of the brands). 

Here is the link https://www.dropbox.com/s/jk3wnttwec8jevn/testeee.pbix?dl=0

Hi, @GoncaloCare 

I am not sure whether I understood your question correctly.

I assume you want to group less than 1% into Others, right? 

Please check the link down below.

Please also check the Brands Table -> I created "Others" as index number 128. 

 

https://www.dropbox.com/s/ox56wrttiyyzb2w/testeee.pbix?dl=0 

 

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi @Jihwan_Kim 

You are amazing! Thank you so much, this is perfect! You really helped me! 

 

Kudos for you!

 

Best regards!

Hi! I will for sure try your solution! I'll reply again If I need any assistance! Thank you very much!

amitchandak
Super User
Super 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])))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi! Thank you very much! I will try that solution, and If I need any assistance, I'll reply again. Thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.