Forum Discussion
dcruise
8 years agoFrequent Visitor
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 ...
- 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
v-yuta-msft
Community Support
8 years agoHi 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
dcruise
8 years agoFrequent Visitor
With a couple tweaks, I think this will do it! Thank you so much.