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
jt024
Frequent Visitor

Using Rankx for multiple column sort/group

hi there,

 

I'm hoping someone here can help as I've been trying to figure it out for a few days and no luck. 

I am trying to show a matrix visual and that shows each week as a column and it shows the items that fall on each week.

 

I am using the Rankx function to show the order on which the items appear.

Here is my formula:

 

 

Ranking = 
RANKX(
    FILTER(ALLSELECTED(OSCR),
     OSCR[WeeklyDate]= EARLIER(OSCRTransformed[WeeklyDate])),
CALCULATE(SUM(OSCR[Index]),FILTER(OSCR,OSCR[Index] <= EARLIER(OSCR[Index] ))),,ASC) ​

 

 

 

My problem is when it genearates the matrix visual, some of the 'blocks' are 'floating'. The ranking is skipping numbers.

I need it to rank based on the following :

By area, key and week

 

Is this possible?

I need it to number or order the rank based on what area it's in, the key and what week it falls in. Right now it just does the week. So for a particular week it will number it, say 1-15, except it includes different areas and keys. 

How can I add the other two in the formula? 

 

Thanks in advance!

1 ACCEPTED SOLUTION
jt024
Frequent Visitor

I got it working.

 

I just added an "AND" statement (use "&&" if you have more than 2 conditions) and it works.

 

Just wanted to post here in case someone else encounters this issue.

 

Thank you!

View solution in original post

2 REPLIES 2
NilR
Post Patron
Post Patron

I like to see how your code turned out. can you post it here too?
jt024
Frequent Visitor

I got it working.

 

I just added an "AND" statement (use "&&" if you have more than 2 conditions) and it works.

 

Just wanted to post here in case someone else encounters this issue.

 

Thank you!

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.