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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
jameschung
Frequent Visitor

Comparing different schedules using a generic month - RankX missing months? Better approach?

Hi all,

 

I am trying to compare multiple projects to see when (and how frequently) certain items are occurring during the course of a project.

 

One project may have started in 2017, another may have started in 2019, and I'd like to be able to count how many times certain events occurred in say month 4 or month 5 or month 6 of each project, as they roughly last the same amount of time.

 

I have the Project name and the Received Date of the event. So one idea was to create a column to "lookup" which contains the year and month

 

Lookup = format('Data'[Received Date],"YYYY-MM")

 

Using that Lookup, column, I tried to use RankX to rank each month by project.

 

rankx = rankx(filter('Data','Data'[Project]=earlier('Data'[Project])),'Data'[Lookup],,ASC,Dense)
 
Capture.PNG
This worked reasonably well, except, there are some months with no data whatsoever, and they are not included in the rank. This happens a lot at the beginning of the project when there are many months where it is quiet before it ramps up towards the end.
Any thoughts/ideas would be greatly appreciated.

 

Sample File 

1 ACCEPTED SOLUTION
nhoward
Resolver I
Resolver I

Hi @jameschung ,

 

It sounds like you need to know how many months there are between the start date of a project and the data of a transactions/event. 

 

The DAX function DATEDIFF should be able to help. 

 

the sample data didn't indicate what your data model is, so i have to make some assumptions.  I assume you have a project table, which has a column for start date.  then you have a transactions table.   You might be able to add a column to the transactions table to show how many months since start date this event happened.  Use your lookup to add a column for the start date, then you can use datediff to get the month number of the project. 

 

Month of Project = DATADIFF('Data'[Start Date],'Data'[Recieved Date],Month)

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @jameschung ,

 

I agree with @nhoward  answer.

 

Best regard,
Lionel Chen

nhoward
Resolver I
Resolver I

Hi @jameschung ,

 

It sounds like you need to know how many months there are between the start date of a project and the data of a transactions/event. 

 

The DAX function DATEDIFF should be able to help. 

 

the sample data didn't indicate what your data model is, so i have to make some assumptions.  I assume you have a project table, which has a column for start date.  then you have a transactions table.   You might be able to add a column to the transactions table to show how many months since start date this event happened.  Use your lookup to add a column for the start date, then you can use datediff to get the month number of the project. 

 

Month of Project = DATADIFF('Data'[Start Date],'Data'[Recieved Date],Month)

Thanks @nhoward. I hadn't considered that approach and it's useful for another problem I was having too! Much appreciated.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.