March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe 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
Hi,
I have a list of Customers with Start and End Dates for a program. Here's some example data:
Customer ID | Start Date | End Date |
A | 10/09/2024 | |
B | 01/06/2024 | 05/08/2024 |
C | 03/10/2024 | 05/11/2024 |
D | 08/08/2024 | |
E | 24/05/2024 | 25/10/2024 |
F | 01/11/2024 | |
G | 23/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 Month | Active Users |
August 2024 | 3 (B, D & E) |
September 2024 | 4 (A, D, E & G) |
October 2024 | 5 (A, C, D, E, & G) |
November 2024 | 5 (A, C, D, F & G) |
Any thoughts on how to do this?
Thanks,
Mark
Solved! Go to 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
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
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.
Proud to be a Super User!
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
Hi,
Please check the below picture and the attached pbix file.
I tried to use calendar dimension table.
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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
86 | |
73 | |
58 | |
52 |
User | Count |
---|---|
196 | |
125 | |
107 | |
68 | |
65 |