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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.