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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Count distinct rows between two dates

Hi all,

 

I need to create a simple measure that returns the number of rows where the value in a date column falls between two dates. I have had some success, but it only seems to return non-distinct values (for example, if two dates are the same it returns just '1' value). Any help would be greatly appreciated.

 

Specifically, the measure I want to create goes something like this:

 

Events in Next 90 Days = 

CALCULATE(

DISTINCTCOUNT('Table'[Event]),

DATESBETWEEN('Table'[Due Date],Today(), Today()+90)

))

 

Here is the table:

 

EventDue Date
Event 115/06/2022
Event 230/06/2022
Event 305/07/2022
Event 415/10/2022
Event 520/11/2022
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Which part is wrong? According to your description, just change the distinctcount() to count() and it will be fine.

Events in Next 90 Days = 

CALCULATE(

COUNT('Table'[Event]),

DATESBETWEEN('Table'[Due Date],Today(), Today()+90)

))

 

Best Regards,

Jay

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

 

Which part is wrong? According to your description, just change the distinctcount() to count() and it will be fine.

Events in Next 90 Days = 

CALCULATE(

COUNT('Table'[Event]),

DATESBETWEEN('Table'[Due Date],Today(), Today()+90)

))

 

Best Regards,

Jay

Anonymous
Not applicable

I've tried that, and literally everything else, but nothing is working sadly.

Anonymous
Not applicable

Hello

Try to use countrows instad of distinctcount

Anonymous
Not applicable

I did manage to get this working, but it only includes one filter: if the date is in the past. What I need is for this simple measure to include an additional time-based filter so that I can target all values that fall between two dates:

 

Risks Overdue =

CALCULATE(COUNT(Table[Event]),

FILTER(Table,Table[Event].[Date] < Today() ))

Anonymous
Not applicable

ok. Try this as measure

Event within 90days =
var mindate=today()
var maxdate=today()+90
var result=countrows(filter(summarize(Feuil7,Feuil7[Due Date]),Feuil7[Due Date]>=mindate&&Feuil7[Due Date]<=maxdate))
return
result

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon & SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

Users online (11,693)