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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Julia_Mav
Advocate I
Advocate I

Market Share 100%

Hi, could someone please help with the market share percentage formula? I would like it to match the one in the screenshot, and even if any filters are applied, I still want to see where 100% equals the total products. Thank you in advance!
'Product details'[Product Category] 'Sales'[Sales$] 'Procuct'[Product Name]
 

unnamed.png

1 ACCEPTED SOLUTION

Hi @Julia_Mav ,
I was supposed to post this earlier but forgot to hit reply...

 

Is Product a separate dimensions table? If so:

  • what is the relationship flow of this table to the fact ta ble? - should be one to many and single direction
  • which column is in the visual/slicer? From fact or dimension?

You can see in the below screenshot that your formula should work fine assuming your the correct setup is used.

danextian_0-1716247694886.png

 

danextian_1-1716247710704.png

Please see attached pbix for you reference.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

4 REPLIES 4
v-kaiyue-msft
Community Support
Community Support

Hi @Julia_Mav ,

 

Thanks for the reply from @danextian , please allow me to provide another insight: 

 

Try the following expression:

Market Share % = 
VAR _CurrentCategory = SELECTEDVALUE('Product details'[Product Category])
VAR _TotalSalesAllProductsInCategory =
    CALCULATE(
        [Sales $],
        ALL('Product'),
        'Product details'[Product Category] = _CurrentCategory
    )
RETURN
    DIVIDE(
        [Sales $],
        _TotalSalesAllProductsInCategory
    )


Alternatively, you can try using calculated columns instead of measures, which are static values added to a table and calculated row by row as the data is loaded. In contrast, a measure is a dynamic value that changes depending on what you are looking at in the report, calculated dynamically in the context of the visual object's filters. More detailed information can be found at the link: 

Understanding Measures vs Calculated Columns in Power BI (gorilla.bi)

 

If these still didn't solve your problem. Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

 

Best Regards,

Clara Gong

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

danextian
Super User
Super User

Hi @Julia_Mav 

What is this for?

danextian_0-1716207697214.png

Please provide context?

By 100% you mean, you want the total to be always 100% even if the sum of the breakdown isn't? Please  elaborate. Provide a workable sample data that isn't an image and your expected result from that sample data.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you @danextian

I am using this formula, and it works when no filters are applied. However, when I filter for a specific product category, I see 100% instead of seeing the proportion it represents of all products.  
 
Formula: 
% = 
var _totalsalesallproducts =
CALCULATE([Sales $], ALL(‘Product'[Product Name]))
RETURN DIVIDE(
    [Sales $],
    _totalsalesallproducts)


unnamed.png
 
 

Hi @Julia_Mav ,
I was supposed to post this earlier but forgot to hit reply...

 

Is Product a separate dimensions table? If so:

  • what is the relationship flow of this table to the fact ta ble? - should be one to many and single direction
  • which column is in the visual/slicer? From fact or dimension?

You can see in the below screenshot that your formula should work fine assuming your the correct setup is used.

danextian_0-1716247694886.png

 

danextian_1-1716247710704.png

Please see attached pbix for you reference.










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.