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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Toni_H
Frequent Visitor

Rank Output based on Selected Criteria

Hello,

Essentially I need to figure out a way to see a list of students based on best fit to my selected search criteria.
Example:
A user chooses 5 criteria for search (range between 1-10), any students who match at least one criteria will be displayed, with the students matching the most search criteria displayed at the top and sorted in descending order (i.e. students who match all 5 criteria would be displayed at top, descending down to students who only meet one criteria). The students should have a percentage match displayed (e.g. students matching all 5 criteria would display 100%, students who match 4 criteria would display 80%, down to students who only match one criteria displaying 20%). If more than one student has the same exact percentage match, the students should be displayed in A-Z alpha ordering.

I was thinking that a switch statement could work, but my attempts have not been successful.
The slicers will be on separate pages because ultimately they could select from 28 criteria.

Toni_H_0-1653437321097.png

 


Thanks so much!

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1653450171163.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

4 REPLIES 4
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1653450171163.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Thank you so much for taking the time to provide the pbix file. I was having issues sending mine as a link.

I am hopeful that this will work. However, is there a way to make the denominator dynamic? Sometimes they will select from 2 slicers other times 5 or 10?

Thanks again.

TH

amitchandak
Super User
Super User

@Toni_H , First create a measure on match criteria

new measure =
var _max = maxx(allselected(criteria1),criteria1[Date])
var _min = minx(allselected(criteria1),criteria1[Date])
return
calculate( sum(Table[Value]), filter('Table', 'Table'[attitude] >=_min && 'Table'[attitude] <=_max))

 

add other too

 

then create a measure

 

Rankx(allselected(Table[Name]),[new measure],,desc,dense)

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Thank you for taking the time to respond.
This does work, but I would need to create a rank measure that considers all the criteria selected in the slicers.

Not sure how that would work...

Thanks again for your help,

TH

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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