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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Ranking based on date/time and 2 filters

Hi,

 

Looking to create a ranking measure based on the earliest date/time to the latest date/time.

That is simple enough but need the rank to change / reset when both the Site/Plant and Sales Date change...  So in effect will get the ranking by day by site/plant... The idea is I have another table with the Site/Plant & SAP CODE and the ranking order to compare the actual result to... Example if the result is 1,3,2,5,4   then it will show out of sequence or the like....

 

Attempts so far have been very limited.... 

 

Thanks in anticipation.

 

Sample data below...

 

Spudduk_0-1676306967187.png

 

2 REPLIES 2
Anonymous
Not applicable

Sorry for not getting back sooner. The way the data is setup I am unable to create the collumn in the dataset as it is direct query.

 

Also I may have got you all confused as the data is not all in a sequence either (Screenshot was a poor example) as this was already filtered and sorted  to some extent.

 

So really looking for a measure that would Rank Items from 1 to xxx based on the Plan Start Date& Time going from Earlist to Latest where Sales Date, Site Plant are the same.... 

 

Spudduk_0-1676538847380.png

 

amitchandak
Super User
Super User

@Anonymous , depending on what you include in rank

 

a new column=

rankx(filter(Table, [Site/ point] = earlier([Site/ point]) && [from_sap_code] =earlier([from_sap_code]) ), [Plan start],,asc,dense)

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.