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
hpatel24779
Helper II
Helper II

count Distinct customers per month

Hi,

 

I have a table with customer id, service type, service start and service end. i also have a calendar table.

 

i want to show per month in a graph, how many unique active users there were. i have searched online and gone through some of the examples but none come close to what i want to achieve.

 

the logic is to count anyone who's service start is before the start of current month and end date is blank or on or after the start of current month.

 

can anyone help!!

 

kind regards

 

Hetal

1 ACCEPTED SOLUTION

Great, if it works could you mark it as a solution for others to find please 🙂


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

3 REPLIES 3
SamWiseOwl
Super User
Super User

Hi @hpatel24779 

Unique people =

var currentdate = firstdate(calendar[date])

var finaldate = lastdate(calendar[date])

Return
Calculate( distinctcount(table[customer id]), table[startdate] <= Currentdate && ( table[enddate] >=finaldate || isblank(table[enddate]))

 

Capture the start and end date of the current month filter.

Filter the table to everyone whose start is before the earliest date and after the current date or blank.

 


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

@SamWiseOwl thank you for this. it works perfectly. much appreciated

 

 

Great, if it works could you mark it as a solution for others to find please 🙂


If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

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.