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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
rajendrabhole
Regular Visitor

DAX query EARLIER function work for date range

I want to count number of records before date. For example,

Iteration.StartDateIteration.EndDateNewStateWithStartDate.ChangedDateColumn
01-01-2021 00:0018-07-2021 00:0015-07-2021 12:4644130
01-01-2021 00:0018-07-2021 00:0011-03-2021 21:1844130
01-01-2021 00:0018-07-2021 00:0011-03-2021 21:1844130
01-01-2021 00:0018-07-2021 00:0011-03-2021 21:1844130

 

So in my Column there should be 4 rows if I put condition `Iteration.StartDate < NewStateWithStartDate.ChangedDate,
I written DAX function for calculating count of rows,

Column = SUMX( JoinTable, IF ( EARLIER (JoinTable[Iteration.StartDate]) <= JoinTable[NewStateWithStartDate.ChangedDate], 1, 0 ) )

I want range of StarDate and EndDate must be less than ChangedDate.

In my actual problem there are so many StartDate, EndDate and ChangedDate.

 

@developer 

1 ACCEPTED SOLUTION
V-lianl-msft
Community Support
Community Support

Hi @rajendrabhole ,

 

Please try to create DAX like below:

Column 2 = COUNTROWS(FILTER('Table','Table'[Iteration.StartDate]<='Table'[NewStateWithStartDate.ChangedDate]&&'Table'[Iteration.EndDate]<='Table'[NewStateWithStartDate.ChangedDate]))


Best Regards,
Liang
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

1 REPLY 1
V-lianl-msft
Community Support
Community Support

Hi @rajendrabhole ,

 

Please try to create DAX like below:

Column 2 = COUNTROWS(FILTER('Table','Table'[Iteration.StartDate]<='Table'[NewStateWithStartDate.ChangedDate]&&'Table'[Iteration.EndDate]<='Table'[NewStateWithStartDate.ChangedDate]))


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

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.