Forum Discussion

calebfoster's avatar
calebfoster
New Member
2 years ago
Solved

90 Days From First Purchase Date?

Hello, I am having a difficult time figuring out this Power BI exercise that uses AdventureWorks data. Here is my PBIX file: LINK . I must replicate the following screenshot in Power BI, specifically...
  • Daniel29195's avatar
    2 years ago

    calebfoster 

     

    ooutput

     

     

    returned users within 90 days= 
    var ds = 
    distinct(
    SELECTCOLUMNS(
        FILTER(Sales,Sales[CustomerKey] = RELATED(Customers[AltCustomerKey])
        && Sales[OrderDate] = RELATED(Customers[DateFirstPurchase])
        ),
        Sales[CustomerKey]
    ))
    
    var ds_90_days = 
    DISTINCT(
    SELECTCOLUMNS(
    FILTER(
    all(sales),
    Sales[OrderDate]> MIN('Date'[Date]) && Sales[OrderDate] <=MIN('Date'[Date]) + 90 
    ),Sales[CustomerKey]
    ))
    
    var res = 
    INTERSECT(ds,ds_90_days)
    
    return COUNTROWS(res)

     

    let me know if this works for you .

     

     

    If my answer helped sort things out for you, i would appreciate a thumbs up 👍 and mark it as the solution
    It makes a difference and might help someone else too. Thanks for spreading the good vibes! 🤠