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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
sglendenning
Helper II
Helper II

Calculate Active Customers

I have the effective date, expiration date, and void date and I have a date table but it is joined with a different field other than the effective date.

 

When using a matrix visual by year everything looks reasonable until I get to 2024 where 2024 is low.  If I expand the matrix to the month level within a year prior to 2024 I get a much lower number.  The total for the year column prior to 2024 is ok but the month level is not correct.

 

I'm using;

CALCULATE(COUNT(CustomerKey),FILTER(EffectDate<=MAX('Date'[Date])&&ExpireDate>=MAX('Date'[Date])||VoidDate>MAX('Date'[Date])))
1 ACCEPTED SOLUTION

Hi @sglendenning 

 

Would a measure like this help?

Active = 
VAR _Start = MIN( 'Date'[Date] )
VAR _End = MAX( 'Date'[Date] )
VAR _Count =
    CALCULATE(
        DISTINCTCOUNT( 'Table'[CustKey] ),
        'Table'[AcqDate] <= _End
            && COALESCE( 'Table'[CancelDate], 'Table'[ExpireDate] ) >= _Start
    )
RETURN
    _Count

 

Let me know if you have any questions.

 

Active Customers.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!

View solution in original post

3 REPLIES 3
sglendenning
Helper II
Helper II

Sample Data;

AcqDateExpireDateCancelDateCustKey

 

4/25/2022

4/24/20231/16/202312174780
4/27/20224/26/20238/30/202224971035
4/25/20224/24/2023 16721256
4/7/20224/6/2023 36296808

 

Expected Output via Matrix;

Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22Jan-23Feb-23Mar-23Apr-23 20222023
4444333332222 3

2

Hi @sglendenning 

 

Would a measure like this help?

Active = 
VAR _Start = MIN( 'Date'[Date] )
VAR _End = MAX( 'Date'[Date] )
VAR _Count =
    CALCULATE(
        DISTINCTCOUNT( 'Table'[CustKey] ),
        'Table'[AcqDate] <= _End
            && COALESCE( 'Table'[CancelDate], 'Table'[ExpireDate] ) >= _Start
    )
RETURN
    _Count

 

Let me know if you have any questions.

 

Active Customers.pbix

 



Proud to be a Super User!

daxformatter.com makes life EASIER!
Greg_Deckler
Community Champion
Community Champion

@sglendenning Sample data would help to be more specific. 
Take a look at these two Quick Measures as I think you want something like them.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Open-Tickets/m-p/409364
https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365

 

Otherwise, Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.