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
Mark_Holland_GD
Helper III
Helper III

Active Users between Date Ranges, each Month

Hi,

 

I have a list of Customers with Start and End Dates for a program. Here's some example data:

 

Customer IDStart DateEnd Date
A10/09/2024 
B01/06/202405/08/2024
C03/10/202405/11/2024
D

08/08/2024

 
E24/05/2024

25/10/2024

F01/11/2024 
G23/09/2024 

 

I want to have a chart that shows the total number of Active Users each month based on these dates. An Active User must have a Start Date that is greater than or equal to the reporting month start date, and either have a blank End Date or and End Date this is less than or equal to the reporting month end date. 

 

So the table above would show the following results:

 

Reporting MonthActive Users
August 20243 (B, D & E)
September 20244 (A, D, E & G)
October 20245 (A, C, D, E, & G)
November 20245 (A, C, D, F & G)

 

Any thoughts on how to do this?

 

Thanks,

Mark

1 ACCEPTED SOLUTION

Hi @danextian,

 

We're almost there. I made a couple of small amendments to the DAX and it's now working:

Total Puppies in Training = CALCULATE([Total Dog Codes], 
CONTAINSSTRING('PROGRAM ENGAGEMENT'[Dog Program Classification], "C2"),
FILTER(SUMMARIZE('PROGRAM ENGAGEMENT', 'PROGRAM ENGAGEMENT'[Program Start Date], 'PROGRAM ENGAGEMENT'[Program End Date]),
'PROGRAM ENGAGEMENT'[Program Start Date] <= MAX('02: Calendar'[Dates]) && ( 'PROGRAM ENGAGEMENT'[Program End Date] > MAX( '02: Calendar'[Dates]) || ISBLANK('PROGRAM ENGAGEMENT'[Program End Date]))))

In my example, I'm looking to count the number of Puppies in our training program, which is the classification filter in this DAX.

 

Thanks,

Mark

View solution in original post

4 REPLIES 4
Kedar_Pande
Super User
Super User

@Mark_Holland_GD 

Create a Date Table:

DateTable = 
ADDCOLUMNS (
CALENDAR (DATE(2024, 1, 1), DATE(2025, 12, 31)),
"Year", YEAR([Date]),
"Month", MONTH([Date]),
"MonthYear", FORMAT([Date], "YYYY-MM")
)

Create a measure:

Active Users = 
VAR StartOfMonth = STARTOFMONTH(DateTable[Date])
VAR EndOfMonth = ENDOFMONTH(DateTable[Date])

RETURN
CALCULATE (
COUNTROWS(Customers),
FILTER (
Customers,
Customers[Start Date] <= EndOfMonth &&
(
ISBLANK(Customers[End Date]) || Customers[End Date] >= StartOfMonth
)
)
)

💌 If this helped, a Kudos 👍 or Solution mark would be great! 🎉
Cheers,
Kedar
Connect on LinkedIn

 

danextian
Super User
Super User

Hi @Mark_Holland_GD 

 

I answered a similar post a few days ago. In the attached file, you will see a measure that uses a disconnected table and one that has a relationship to start date.

danextian_0-1730956893506.png

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian,

 

We're almost there. I made a couple of small amendments to the DAX and it's now working:

Total Puppies in Training = CALCULATE([Total Dog Codes], 
CONTAINSSTRING('PROGRAM ENGAGEMENT'[Dog Program Classification], "C2"),
FILTER(SUMMARIZE('PROGRAM ENGAGEMENT', 'PROGRAM ENGAGEMENT'[Program Start Date], 'PROGRAM ENGAGEMENT'[Program End Date]),
'PROGRAM ENGAGEMENT'[Program Start Date] <= MAX('02: Calendar'[Dates]) && ( 'PROGRAM ENGAGEMENT'[Program End Date] > MAX( '02: Calendar'[Dates]) || ISBLANK('PROGRAM ENGAGEMENT'[Program End Date]))))

In my example, I'm looking to count the number of Puppies in our training program, which is the classification filter in this DAX.

 

Thanks,

Mark

Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

I tried to use calendar dimension table.

 

Jihwan_Kim_1-1730955970381.png

 

 

 

Jihwan_Kim_0-1730955915928.png

 

 

Active customers count: = 
VAR _t =
    FILTER (
        customer,
        customer[Start Date] <= MAX ( 'calendar'[Date] )
            && OR (
                ISBLANK ( customer[End Date] ),
                customer[End Date] >= MIN ( 'calendar'[Date] )
            )
    )
RETURN
    COUNTROWS ( _t )

 

Active customers list: = 
VAR _t =
    FILTER (
        customer,
        customer[Start Date] <= MAX ( 'calendar'[Date] )
            && OR (
                ISBLANK ( customer[End Date] ),
                customer[End Date] >= MIN ( 'calendar'[Date] )
            )
    )
RETURN
    CONCATENATEX ( _t, customer[Customer ID], ", " )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

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.