Forum Discussion

dcruise's avatar
dcruise
Frequent Visitor
8 years ago
Solved

CALCULATE DISTINCT For Rolling Time Period

I have a sales dataset of a bunch of customer transactions. We are breaking these transactions by Invoice Period which is essentially the last day of the month. (i.e. Invoice Date is June 7, Invoice ...
  • v-yuta-msft's avatar
    8 years ago

    Hi dcruise,

     

    You should use all() to remove the previous filter context, modify you measure using DAX like pattern below and check if it can meet your requirement:

    Active Customers = 
    CALCULATE (
        DISTINCTCOUNT ( Sales[StoreLicense] ),
        FILTER (
            ALL ( Sales ),
            Sales[InvoicePeriod]
                >= MAX ( Sales[InvoicePeriod] ) - 80
                && Sales[InvoicePeriod] <= MAX ( Sales[InvoicePeriod] )
        )
    )

     

     

    Regards,

    Jimmy Tao