Forum Discussion
Calculating Market Share Over Time
I am trying to display the marketshare for various accounts over time and am struggling with which DAX formula to use. I have a simple table (Week Ending Date, Account Name, Units Sold). I would like to display the marketshare for each account over time (year, month, week etc.). I would like to display this information with a line graph. Everything I try either calculates the marketshare based on the total period (i.e. the % of one weeks' sales for one account out of the total sales of all accounts across all time) or it shows all accounts at 100% for each week ending date. Can anyone help me??
Hi rwelsh11,
Could you try using the formula below to create a new measure to calculate marketshare, then show the measure as Values, "Week Ending Date" as Axis, and "Account Name" as Legend on the Line Chart visual to see if it works in your scenario? :smileyhappy:
measure = DIVIDE ( SUM ( 'Table1'[Week End Date] ), CALCULATE ( SUM ( 'Table1'[Week End Date] ), ALL ( 'Table1'[Account] ) ) )Remark: replace 'Table1' with your real table name.
Regards
4 Replies
- rwelsh11Frequent Visitor
I am trying to calculate the market share for a variety of accounts over several years and am struggling with the DAX. I have a very simple table (Week End Date, Account, Units Sold) and I am trying to graph the relative marketshare for each account with a line graph over time (week ending dates run 2014 - 2017). My challenge is that I either get the % of one weeks' sales at one account out of the total sales for all accounts across the entire period or I see every data point at 100%. I basically want to calculate the marketshare for each account during a given week (totalling 100% for each week) and then graph that across all the weeks in a line graph. Please help!!
- Ashish_MathurSuper User
Hi,
Share some data and show the expected result.
- v-ljerr-msftMicrosoft Employee
Hi rwelsh11,
Could you try using the formula below to create a new measure to calculate marketshare, then show the measure as Values, "Week Ending Date" as Axis, and "Account Name" as Legend on the Line Chart visual to see if it works in your scenario? :smileyhappy:
measure = DIVIDE ( SUM ( 'Table1'[Week End Date] ), CALCULATE ( SUM ( 'Table1'[Week End Date] ), ALL ( 'Table1'[Account] ) ) )Remark: replace 'Table1' with your real table name.
Regards
- rwelsh11Frequent Visitor
This is great thanks!