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
Anonymous
Not applicable

DAX Mobile Brand wise rank

Hi every one,

 

I have mobile brands with excel file.  Please find excel file in this link.

 

should count "column 0" and multiply with 7

should count "column 1" and multiply with 6

remaing also decrease the number and multiply with counts.

 

need to do addition for all columns multiply with respective number. then provide rank each brand wise.

 

Please refer my excel file to more understad.

 

my output should come like below table....

 

mobileScoreRank
Apple69661
Spice68192
Samsung66433
Motorola66274
Xiaomi66275
OnePlus66196
Karbonn65977
Oppo65948
LYF65809
Lava657810
Nokia654911
Honor646112
Huawei643613
Asus642514
Gionee639615
Acer636416
HTC636317
Vivo635918
Xolo626419
Intex625020
Lenovo624721
Micromax615422
Jio606423

 

 

can any one help on this....

 

regards

Venu

 

 

1 ACCEPTED SOLUTION

The logic I built for you was rather correct. The numbers were coming out wrong because you didn't have a master list of mobile values. The rank measure stays the same.

 

EDIT: Added tiebreaker

 

Step 1: Create a new table:

MobileValues = VALUES('Mobile Score'[Mobile 0])

Step2: Create your three measures:

Countx7 = 
var Mobile0 = CALCULATE(COUNT('Mobile Score'[Mobile 0]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile 0])) * 7
var Mobile1 = CALCULATE(COUNT('Mobile Score'[Mobile1]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile1])) * 6
var Mobile2 = CALCULATE(COUNT('Mobile Score'[Mobile2]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile2])) * 5
var Mobile3 = CALCULATE(COUNT('Mobile Score'[Mobile3]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile3])) * 4
var Mobile4 = CALCULATE(COUNT('Mobile Score'[Mobile4]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile4])) * 3
var Mobile5 = CALCULATE(COUNT('Mobile Score'[Mobile5]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile5])) * 2
var Mobile6 = CALCULATE(COUNT('Mobile Score'[Mobile6]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile6]))
return
Mobile0+Mobile1+Mobile2+Mobile3+Mobile4+Mobile5+Mobile6

 

TieBreaker = CALCULATE(COUNT('Mobile Score'[Mobile 0]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile 0]))
RankMe = IF(HASONEVALUE(MobileValues[Mobile 0]), RANKX(ALLSELECTED(MobileValues[Mobile 0]), [Countx7] + [TieBreaker],,DESC,Dense), BLANK())

 


Step3: With your new master list inside a table:

rank_me3.PNG



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

    

I don't understand your logic with the count and multiplication but I'll assume you want something similar:

Countx7 = COUNT('Mobile Score'[Mobile 0])*7 + COUNT('Mobile Score'[Mobile1])*6

After you get your count that you want the you should add a measure to rank them:

 

RankMe = RANKX(ALLSELECTED('Mobile Score'[Mobile 0]), [Countx7])

rankme.PNG



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Anonymous
Not applicable

@hnguy71 Thanks for your response....

 

should apply logic for all columns....

 

should count "column 0" and multiply with 7

should count "column 1" and multiply with 6

should count "column 2" and multiply with 5

should count "column 3" and multiply with 4

should count "column 4" and multiply with 3

should count "column 5" and multiply with 2

should count "column 6" and multiply with 1

 

when you count on each column it showing ranking on different brands. when you multiply score to each column. 

then it showing different ranking for each brand.

 

should do addition after apply multiplication, and provide ranking.

I'm guessing you just add more counts to all the columns.

 

Countx7 = 
COUNT('Mobile Score'[Mobile 0])*7 + 
COUNT('Mobile Score'[Mobile1])*6 + 
COUNT('Mobile Score'[Mobile2])*5 + 
COUNT('Mobile Score'[Mobile3])*4 + 
COUNT('Mobile Score'[Mobile4])*3 + 
COUNT('Mobile Score'[Mobile5])*2 + 
COUNT('Mobile Score'[Mobile6])*1


Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Anonymous
Not applicable

@hnguy71 thanks for your valueble time.....

 

your formula gives results like below, total value is wrong, and ranking brand also wrong. 

 

my expected output have already mention in above.... can you check with my excel file. before provide solution.

 

mobile-brand-result.jpg

 

The logic I built for you was rather correct. The numbers were coming out wrong because you didn't have a master list of mobile values. The rank measure stays the same.

 

EDIT: Added tiebreaker

 

Step 1: Create a new table:

MobileValues = VALUES('Mobile Score'[Mobile 0])

Step2: Create your three measures:

Countx7 = 
var Mobile0 = CALCULATE(COUNT('Mobile Score'[Mobile 0]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile 0])) * 7
var Mobile1 = CALCULATE(COUNT('Mobile Score'[Mobile1]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile1])) * 6
var Mobile2 = CALCULATE(COUNT('Mobile Score'[Mobile2]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile2])) * 5
var Mobile3 = CALCULATE(COUNT('Mobile Score'[Mobile3]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile3])) * 4
var Mobile4 = CALCULATE(COUNT('Mobile Score'[Mobile4]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile4])) * 3
var Mobile5 = CALCULATE(COUNT('Mobile Score'[Mobile5]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile5])) * 2
var Mobile6 = CALCULATE(COUNT('Mobile Score'[Mobile6]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile6]))
return
Mobile0+Mobile1+Mobile2+Mobile3+Mobile4+Mobile5+Mobile6

 

TieBreaker = CALCULATE(COUNT('Mobile Score'[Mobile 0]), TREATAS(VALUES(MobileValues[Mobile 0]), 'Mobile Score'[Mobile 0]))
RankMe = IF(HASONEVALUE(MobileValues[Mobile 0]), RANKX(ALLSELECTED(MobileValues[Mobile 0]), [Countx7] + [TieBreaker],,DESC,Dense), BLANK())

 


Step3: With your new master list inside a table:

rank_me3.PNG



Did I answer your question?
Please help by clicking the thumbs up button and mark my post as a solution!
Anonymous
Not applicable

@hnguy71   Thanks for your reply.... really done good job...

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.