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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Rank

 

Hi,

 

I have a table, Table1, and I want to rank multiple meters by End date in the following format.

 

Can you help?

 

Meter              End Date     Rank
1000364810   2008 06        1
1000364810   2009 06        2
1000364810   2012 06        3
1000364810   2015 06        4
1000364810   2020 04        5

 

Many thanks in advance!

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @PMF99 

 

please see the below

=VAR m = Resign_Append[meter]
RETURN
RANKX(
FILTER(Resign_Append,
Resign_Append[meter] = m
),
Resign_Append[CED YYYY MM],,
ASC
)

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Mariusz
Community Champion
Community Champion

Hi @Anonymous,

You can add a column and the code below.

Rank Meter by End Date = 
VAR m = Table1[Meter]
RETURN 
RANKX(
    FILTER(
        Table1,
        Table1[Meter] = m
    ), 
   Table1[End Date],,
   ASC
)


Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Many thanks Mariusz;

I tried your code;

 

=VAR m = Resign_Append[Renewal Date]
RETURN
RANKX(
FILTER(Resign_Append,
Resign_Append[CED YYYY MM] = m
),
Resign_Append[CED YYYY MM],,
ASC
)

 

And here's the error I've got;

 

DAX comparison operations do not support comparing values of type Text with values of type Date. Consider using the VALUE or FORMAT function to convert one of the values.

 

What have I done wrong?

 

Thanks

Peter

 

 

 

Mariusz
Community Champion
Community Champion

Hi @PMF99,

Try,

=VAR m = Resign_Append[Renewal Date]
RETURN
RANKX(
FILTER(Resign_Append,
Resign_Append[Renewal Date] = m
),
Resign_Append[CED YYYY MM],,
ASC
)

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Mariusz,

 

Think we're almost there...

 

Here is my code....

 

=VAR m = Resign_Append[CED YYYY MM]
RETURN
RANKX(
FILTER(Resign_Append,
Resign_Append[CED YYYY MM] = m
),
Resign_Append[CED YYYY MM],,
ASC
)

 

 

And here is the pivot results under Resign Order

Capture.PNG

Getting only '1s'

 

Any ideas? I would expect meter 1000364810 to have a resigner order for CED YYYY MM of 1, 2, 3, 4, 5,

 

 

 

 

Mariusz
Community Champion
Community Champion

Hi @PMF99 

 

please see the below

=VAR m = Resign_Append[meter]
RETURN
RANKX(
FILTER(Resign_Append,
Resign_Append[meter] = m
),
Resign_Append[CED YYYY MM],,
ASC
)

Regards,
Mariusz

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Perfect! Thats the answer! 

 

I've ticked the thumbs up box.

 

Is there another 'Accept' button?

AlB
Community Champion
Community Champion

Hi @Anonymous,

If 'End Date' is of type date, you can simply do:

Rank_Column =
RANKX ( CALCULATETABLE(Table1, ALLEXCEPT(Table1, Table1[Meter])), Table1[End Date], Table1[End Date], ASC )

Helpful resources

Announcements
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!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.