How to do it...

To implement this recipe, do the following:

  1. Create a column in the R04_Table table with the following formula:
Unit Market Share = 'R04_Table'[Unit Sales] / SUMX(ALL('R04_Table'),'R04_Table'[Unit Sales])
  1. Create a second column in the R04_Table table with the following formula:
Relative Market Share = 
VAR __LargestCompetitor = MAX('R04_Table'[Unit Market Share])
VAR __SecondLargestCompetitor =
IF(
COUNTROWS(
FILTER(
ALL('R04_Table'),
'R04_Table'[Unit Market Share] = __LargestCompetitor
)
) > 1,
__LargestCompetitor,
MAXX(
FILTER(
ALL('R04_Table'),
'R04_Table'[Unit Market Share] <> __LargestCompetitor
),
'R04_Table'[Unit Market Share])
)
RETURN
IF(
[Unit Market Share] = __LargestCompetitor,
__LargestCompetitor / __SecondLargestCompetitor,
[Unit Market Share] / __LargestCompetitor
)
  1. Format both the Unit Market Share column and the Relative Market Share column as percentages.