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
LuisNC
Helper I
Helper I

Calculate the number of active customers

Hello Dear Community,

I have an Orders table, and I need to count the number of active customers.

An active customer is a customer who has purchased at least once within the last quarter.

Here´s a screen shot of the first rows of the Orders table: 

LuisNC_0-1686654829078.png

And here is a screen shot of the data model:

LuisNC_1-1686654916965.png

 

Could you please help me find out the DAX formula to achieve this calculation?

Many thanks in advance!! 🙂

 

3 REPLIES 3
tamerj1
Super User
Super User

Hi @LuisNC 
Please define "Last Quarter"

Hello @tamerj1 

Thanks for your quick reply.

You are right, Last Quarter needs to be defined.

To be honest this is an exercise to practise, and I can sort of decide what is considered an active customer.

I thought an active customer should have purchased at least once within the last 3 - 4 months, but that is not what you call a Quarter. I understand your point.

What do you think?

Many thanks in advance!!

 

@LuisNC 
The following shall calculate the number of customers active within 3 months before the selected date.

Active Customers =
VAR Period = 3
VAR EndDate =
    MAX ( 'Date'[Date] )
VAR StartDate =
    EDATE ( EndDate, - Period )
RETURN
    COUNTROWS (
        CALCULATETABLE (
            VALUES ( Orders[CustomeID] ),
            'Date'[Date] <= EndDate,
            'Date'[Date] >= StartDate
        )
    )

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.