0
votes

I have a table FactSales

And tried but didn’t get ant satisfactory result.

Id like to calculate old results and compare to my actual one and see how many customers whose bought product B before (before 90 days) didn’t buy the same product in last 3 months according to the date filter

I tried this:

Customers inactive =

VAR Daysbefore90: Max(DimDate[date]) -90

> RETURN CALCULATE( DISTINCTCOUNT(FSales[CustomerKey]); DimProduct[Product] = “A”; FILTER( ALL ( DimDate[Date] ); 

DimDate[Date] < DaysBefore90 ); NOT(CONTAINS( FILTER(FSales; RELATED(DimDate[Date]) >= Daysbefore90 && DimDate[Date]) <= MAX(Daysbefore90): RELATED(DimProduct[Product]) = “A”) ; FSales[CustomerKey]; FSales[CustomerKey] ) ) )

1
Please clean up your code. I can't make sense out of it the way it's currently showing up.Alexis Olson

1 Answers

0
votes

This will get you all customer who purchased item 'B' in the last 90 Days:

Customers Who Bought Product B 90 Days Ago :=
CALCULATE (
    DISTINCTCOUNT ( 'FSale'[CustomerKey] ),
    ALL ( 'DimDate'[Date] ),
    KEEPFILTERS (
        DATESINPERIOD ( 'DimDate'[Date], MAX ( 'DimDate'[Date] ), -90, DAY )
    ),
    KEEPFILTERS ( DimProduct[Product] = "B" )
)

Your question is a little hard to read, so maybe update it and we can go from there.