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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
cmapijushroy
New Member

Nested RankX function help needed and price difference formula require, table attached

I need your precious help to solve the below problem. I need to calculate

1. TENDER WISE, ITEM WISE, COMPANY WISE price RANKING.

2. % of the higher price we quote than the tender winner i.e. RANK1

2020-06-05_210059.jpgI am working like below

nn.jpg

 

But shows the wrong RANK.

 

Please suggest me the code for RANKX and to calculate OUR PRICE DIFFERENCE FORM RANK 1 in %

 

Please help

 

Thanks in Advance

 

Table Attached

Tender NoItemCompanyPrice Quote
A0001ToothpasteCompany A10
A0001ToothpasteCompany B20
A0001ToothpasteMy Company30
A0001ShopCompany B20
A0001ShopMy Company15
A0001DetergentCompany A15
A0001DetergentCompany B10
A0001DetergentMy Company12
B0001ToothpasteCompany XYZ12
B0001ToothpasteCompany ABC15
B0001ToothpasteMy Company25
B0001ToothpasteCompany PQR17
B0001ToothpasteCompany MNO20
1 ACCEPTED SOLUTION
harshnathani
Community Champion
Community Champion

Hi @cmapijushroy ,

 

 

You can create 2 measures.

 

Measure_Price = SUM('Table'[Price Quote])
 
Ranking = RANKX(FILTER(ALL('Table'[Tender No],'Table'[Item],'Table'[Company]),'Table'[Tender No] =MAX('Table'[Tender No]) && 'Table'[Item] = MAX('Table'[Item])),[Measure_Price],,ASC)
 
1.jpg
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

View solution in original post

4 REPLIES 4
harshnathani
Community Champion
Community Champion

Hi @cmapijushroy ,

 

 

You can create 2 measures.

 

Measure_Price = SUM('Table'[Price Quote])
 
Ranking = RANKX(FILTER(ALL('Table'[Tender No],'Table'[Item],'Table'[Company]),'Table'[Tender No] =MAX('Table'[Tender No]) && 'Table'[Item] = MAX('Table'[Item])),[Measure_Price],,ASC)
 
1.jpg
 

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Hi @harshnathani 

Thanks for your reply and I got solution after little change in syntax.

 

But I require another calculation to find out our COMPANY PRICE DIFFERENCE FROM RANK1 PRICE IN %.

 

Please help

Hi @cmapijushroy ,

 

Have posted the solution in this same thread for difference in prices.

 

Pls check.

 

Regards,

Harsh Nathani

 

 

Hi @cmapijushroy ,

 

 

Percent Diff =
For you to calculate the percentage difference.

var d = IF(MAX('Table'[Company]) = "My Company",
Minx(FILter(ALL('Table'),'Table'[Tender No] = MAX('Table'[Tender No]) && 'Table'[Item] = MAX('Table'[Item]) ),'Table'[Price Quote]))

RETURN

IF(MAX('Table'[Company]) = "My Company", DIVIDE( (MAX('Table'[Price Quote]) -d), MAX('Table'[Price Quote])))
 
 
2.JPG

Regards,
Harsh Nathani

Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors