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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.