Forum Discussion
Market Share 100%
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.
Please see attached pbix for you reference.
4 Replies
- Julia_Mav
Helper II
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)- danextian
Super User
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.
Please see attached pbix for you reference.
- AnonymousNot applicable
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.