Forum Discussion
Anonymous
2 years agoNot applicable
dax
p1m = CALCULATE( DISTINCTCOUNT(PSR[customer_code]), FILTER( VALUES(PSR[customer_code]), [sum of ret] > 0 ) ) this is a measure that calculates distinct customer...
- Anonymous2 years ago
Hi Anonymous ,
I suggest you to create a "DimDate" table to help calculation.
DimDate = VAR _CALENDAR = CALENDARAUTO() RETURN ADDCOLUMNS ( _CALENDAR, "Year", YEAR ( [Date] ), "Month", MONTH ( [Date] ), "MonthName", FORMAT ( [Date], "MMMM" ), "RANKX", RANKX ( _CALENDAR, YEAR ( [Date] ) * 100 + MONTH ( [Date] ),, ASC, DENSE ) )Measure:
Sum 3 month count = VAR _SUMMARIZE = SUMMARIZE ( ALL ( DimDate ), DimDate[Year], DimDate[MonthName], DimDate[RANKX], "P1M", [p1m] ) RETURN SUMX ( FILTER ( _SUMMARIZE, [RANKX] > MAX ( DimDate[RANKX] ) - 3 && [RANKX] <= MAX ( DimDate[RANKX] ) ), [P1M] )Result is as below.
Best Regards,
Rico ZhouIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
2 years agoNot applicable