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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
EvertonRamone
Helper I
Helper I

DAX - Inactive customers

 

 I have a measure like below wich returns me all active customers whose in last 90 days bought product category  = 'A'

 

CustomersActive last 90 days:=
VAR Last90Days=
    MAX (DimDate[Date) - 90
RETURN
    CALCULATE (
        DISTINCTCOUNT ( FactSales[CustomerKey]);
        DimProduct[Category] = "A";
        FILTER (
            ALL (DimDate[Date);
             DimDate[Date] >= Last90Day
                && DimDate[Date]  <= MAX (DimDate[Date])
        )
    )

 

Now I need to create a measure INACTIVE CUSTOMERS:

Rule:


1 - Make a list of all distinct customers whose someday bought product = "B" and the date of this was less than my actual filter date

2 - Create a measure using also a distinct count of the last 90 days, but comparing the first list to my actual

3 - If custumer was in the first list (product B) and in my last 90 days (product A) is not appearing, then 1, else 0

 

Thanks

 

 

 

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @EvertonRamone

 

 

I have update my solution, could you have a look at it?

https://community.powerbi.com/t5/Desktop/Customers-who-bought-and-not-bought-some-product-in-last-90...

 

Best Regards

Maggie

Hi @v-juanli-msft, I marked your answer as a solution.

 

Could you help with this one? Is kind of different

Do you have sample data for this?



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

@Greg_Deckler
Try this one:

FactSales   
KeyDateKeyCustomerKeyProductTotal
11112,9
12213
131156,4
141564,8
211894,8
22156,5
312564,85
323564,8
4111325,6
421132,3

 

Customer
KeyCustomerName
1Jean
2Mari
3Lisa
4Julian
5Jhonny

 

Calendar
KeyDateDate
101/01/2018
202/01/2018
301/05/2018
401/08/2018

 

Product
KeyProductProduct
1A
2B
3C

 

I'd like to see something like:

CustomerInactive
Blabla1
abcd0
ggggg1

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors