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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
malikara46
Frequent Visitor

Rank Top 3 competitors by Market share

Dear Power BI community, 

 

I want to display our Top 3 competitors ranked by the market share. 

 

Roughly my table looks like this where each line represents a project with a respective status, volume and if awarded the project winner. Of course if status is lost then a competitor has won the project where we want to display which top 3 competitors have the most share on the overall project volume. 

So the total project volume of all awarded projects (status wonor lost) is 184.000 while Competitor A has won 2 projects with a total volume of 37.000. 

37.000/184.000= 20,11 % market share. 

malikara46_0-1622473458306.png

The final result should look like this where our company and OTHERS should not be listed. 

 

malikara46_2-1622473890274.png

 

I tried something like this to calculate share per Winner but do not know how to filter top 3 out of this. Problem is that OurCompany is also shown on the list so I have to filter it out from the final result

 

VAR Volume =
CALCULATE(
SUM('TK Project'[SMO Volume Market weighted]),
'TK Project'[Status] = "Won" || 'TK Project'[Status] = "Lost")
Var AllVolume =
CALCULATE( SUM('TK Project'[SMO Volume Market weighted]), ALL('TK Project'[Winner]),
'TK Project'[Status] = "Won" || 'TK Project'[Status] = "Lost")
RETURN
DIVIDE(Volume,AllVolume)

 

Would appreciate any help. 

 

With best regards

 

 

 

1 ACCEPTED SOLUTION

Hi  @malikara46 ,

 

First create a column as below:

Percent = 
var _total=CALCULATE(SUM('Table'[ProjectVolume]),FILTER(ALL('Table'),'Table'[Project Status] in {"Won","Lost"}))
var _winner=CALCULATE(SUM('Table'[ProjectVolume]),FILTER(ALL('Table'),'Table'[Winner]=EARLIER('Table'[Winner])&&NOT('Table'[Winner] in {"OurCompany","Others",""})&&'Table'[Project Status]<>"Ongion"))
Return
DIVIDE(_winner,_total)

Then create a measure as below:

_rank = RANKX(ALL('Table'),CALCULATE(MAX('Table'[Percent])),,DESC,Dense)

Put the measure in the filter pane,choose is less than or equal to 3:

v-kelly-msft_0-1622606956798.png

 

And you will see:

v-kelly-msft_2-1622607131749.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@malikara46 in your post you never mentioned that % is based on the won amount, is the ranking on won amount too? What is the logic for that?

 

You have to provide as much clarity as possible, nobody is going to guess what logic you want to work with.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k 

I updated the original post. 

 

So the logic is as following:

 

In the table each line represents a project with a respective status, volume and if awarded (status is won or lost) the project winner. If status is lost then a competitor has won the project where we want to display which top 3 competitors have the most share on the grand total project volume of all the awarded projects. (sum of every project volume with status won or lost)

 

So the sum of all awarded project volumes (status won or lost) is 184.000 while Competitor A has won 2 projects where the sum of those project volumes is 37.000. 

37.000/184.000= 20,11 % market share. 

Hi  @malikara46 ,

 

First create a column as below:

Percent = 
var _total=CALCULATE(SUM('Table'[ProjectVolume]),FILTER(ALL('Table'),'Table'[Project Status] in {"Won","Lost"}))
var _winner=CALCULATE(SUM('Table'[ProjectVolume]),FILTER(ALL('Table'),'Table'[Winner]=EARLIER('Table'[Winner])&&NOT('Table'[Winner] in {"OurCompany","Others",""})&&'Table'[Project Status]<>"Ongion"))
Return
DIVIDE(_winner,_total)

Then create a measure as below:

_rank = RANKX(ALL('Table'),CALCULATE(MAX('Table'[Percent])),,DESC,Dense)

Put the measure in the filter pane,choose is less than or equal to 3:

v-kelly-msft_0-1622606956798.png

 

And you will see:

v-kelly-msft_2-1622607131749.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

Thank you very much!! Works as intended. 

parry2k
Super User
Super User

@malikara46 can you put raw numbers on how you are getting the %?? I don't think what are you replying helping me get to the %? 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

sure sorry for the confusion.

 

Example for "Competitor A" 

 

(37000/184000)*100 = 20,11 %

 

malikara46_1-1622478437791.png

 

 

parry2k
Super User
Super User

@malikara46 how did you get to that %? Not sure how you are calculating it? Rest is the easy part.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k 

Sum of volumes of projects won by competitor X  / sum of all projects with status won or lost. 

 

I now see that 'Project'[Winner] <> "OurCompany" || 'Project'[Winner] <> "OTHERS" in my formula didnt make any sense. So I changed it to this

 
Competitor share=
VAR Volume =
CALCULATE(
SUM('Project'[Volume]),
'Project'[Status] = "Won" || 'Project'[Status] = "Lost")
Var AllVolume =
CALCULATE( SUM('Project'[Volume]), ALL('Project'[Winner]),
'Project'[Status] = "Won" || 'Project'[Status] = "Lost")
RETURN
DIVIDE(Volume,AllVolume)

 

I believe the next logical step is to use "Competitor share" inside a Top n formula. 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.