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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote 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
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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