0

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. Commented Aug 24, 2018 at 22:02

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.