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
Anonymous
Not applicable

RANKX() - Rank at First Month and Last Month of a Custom Time Period Selection

Hi all, 

 

Given the following sample data, along with a timeline slicer which I can select Months such as Jan-Mar, Feb-Apr, Jan-Apr

MonthCustomerSales
JanuaryA10
JanuaryB23
JanuaryC34
FebruaryA12
FebruaryB31
FebruaryC29
MarchA9
MarchB17
MarchC13
April A21
April B13
April C14

 

How do I use Rankx() or a suitable measure to generate the following visual?

 

For timeline Jan-Mar

 

CustomerTotal Sales for Period SelectedRank at Starting Month of Period SelectedCurrent Rank - Rank at Latest Month of Period Selected
A3133
B7121
C7612

 

Here, Starting Month of Period Selected = Jan

Latest Month of Period Selected = Mar

 

Any advise is greatly appreciated

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use Max() and Min() function to calculate the value of max month and min month of time period.

minvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MIN('Table'[month])))

maxvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MAX('Table'[month])))

Then use RANKX() function to rank the values.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could use Max() and Min() function to calculate the value of max month and min month of time period.

minvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MIN('Table'[month])))

maxvalue = CALCULATE(SUM('Table'[Sales]),FILTER('Table','Table'[Customer]=SELECTEDVALUE('Table'[Customer])&&'Table'[month]=MAX('Table'[month])))

Then use RANKX() function to rank the values.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
vanessafvg
Super User
Super User

are you using text for the dates or can you provide the data with proper dates?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Anonymous
Not applicable

Dear @vanessafvg,

 

The dates are in the proper date/time format in the original dataset.

 

I summarized it according to the month name just for the sample data provided above

 

 

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.