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

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.

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?


@ 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!:
The Definitive Guide to Power Query (M)

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.