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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply

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
Community Champion
Community Champion

@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

 










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


Proud to be a Super User!









"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.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.