Forum Discussion
Cumulative Sum
- 5 years ago
Loyal Customers count =
VAR _currentmonthyear =
MAX ( Dates[End of Month] )
VAR _untilcurrentmonthyeartable =
FILTER ( ALL ( Sales ), Sales[Order Date] <= _currentmonthyear )
VAR _customerscounttable =
GROUPBY (
_untilcurrentmonthyeartable,
Sales[Customer ID],
"@customerscount", SUMX ( CURRENTGROUP (), 1 )
)
VAR _loyalcustomerstable =
FILTER ( _customerscounttable, [@customerscount] > 2 )
RETURN
COUNTROWS ( _loyalcustomerstable )
Loyal Customers count =
VAR _currentmonthyear =
MAX ( Dates[End of Month] )
VAR _untilcurrentmonthyeartable =
FILTER ( ALL ( Sales ), Sales[Order Date] <= _currentmonthyear )
VAR _customerscounttable =
GROUPBY (
_untilcurrentmonthyeartable,
Sales[Customer ID],
"@customerscount", SUMX ( CURRENTGROUP (), 1 )
)
VAR _loyalcustomerstable =
FILTER ( _customerscounttable, [@customerscount] > 2 )
RETURN
COUNTROWS ( _loyalcustomerstable )
Works perfectly.
Thanks Jihwan_Kim