Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I have a table that has a Customer AccountID, Date Installed, and Date Cancelled.
I'm looking to create a count of how many customers were active in a given date range. My data source only gives me the current status of the customer. So historical reporting is not there.
I'm trying to create a measure that counts an account as "Active" during a date range, if the cancel date is blank, or AFTER the date.
For example if a customer signed up in January, and cancelled in March. I want to count them as "Active" in January, February, and then cancelled in March.
For example, the accounts below that don't have a cancel date are "Active". The last account on the record should be counted as "Active" until May 14, 2020 (even though the current status is "cancelled" the account WAS active prior to that cancel date.
I hope that makes sense!
Simulated data sources:
Result :
DAX Code:
#Customer =
CALCULATE(
VAR _MINDate =
MIN ( 'Date'[Date] )
VAR _MAXDate =
MAX ( 'Date'[Date] )
VAR _DateRange =
DATESBETWEEN ( 'Date'[Date], _MINDate, _MAXDate )
VAR _Customer =
CALCULATE (
DISTINCTCOUNT ( 'Table'[AccountID] ),
_DateRange,
'Table'[CancelDate-Recent] = BLANK ()
|| 'Table'[CancelDate-Recent] >= _MAXDate
)
RETURN _Customer
, DATESYTD( 'Date'[Date] )
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
26 | |
20 | |
13 | |
8 |
User | Count |
---|---|
76 | |
48 | |
46 | |
20 | |
16 |