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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate the count of customers between two dates.

I have two date columns, StartDate, and Enddate. What I wanted to do is whenever I select a date from the filter, I want to get the calculated value of the count of customers where StartDate < selected date > EndDate.

How can I calculate the count of customers between two dates?
Do I have to create a calendar table to use the date as a filter?
If yes, Power BI allows only one active relationship, so how can I connect the date table with the two date columns StartDate and EndDate with the fact table?

 

Regards

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User
Anonymous
Not applicable

To count distinct values, I used the expression below, and it works fine.
 
Current = CALCULATE([Count of customers],(FILTER(Table,Table[StartDate] < max('Date'[Date]) && (Table[EndDate] > max('Date'[Date])))))

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User
Anonymous
Not applicable

@amitchandak 

Thank you for your reply. can I use Countx and Distinct on the expression?
I want to count distinct customers between two dates.

Anonymous
Not applicable

To count distinct values, I used the expression below, and it works fine.
 
Current = CALCULATE([Count of customers],(FILTER(Table,Table[StartDate] < max('Date'[Date]) && (Table[EndDate] > max('Date'[Date])))))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.