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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.