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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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