Forum Discussion
manar_alamri
1 year agoHelper I
Customers Retention by quarters
Hello everyone , I want to do two things in power bi : first , calculate the customer retention by quarters , years and centers( Customers who returned from the previous quarter to the same cente...
lucadelicio
1 year agoImpactful Individual
As attachment the pbix file.
Try this measure:
Customer Retention by Quarter =
VAR CurrentQuarterStart = STARTOFQUARTER(Table1[date])
VAR CurrentQuarterEnd = ENDOFQUARTER(Table1[date])
VAR PreviousQuarterStart = STARTOFQUARTER(DATEADD(Table1[date], -1, QUARTER))
VAR PreviousQuarterEnd = ENDOFQUARTER(DATEADD(Table1[date], -1, QUARTER))
VAR Center = SELECTEDVALUE(Table1[Center])
VAR PreviousGuest =
CALCULATETABLE(
DISTINCT(Table1[guest code])
,ALL(Table1)
,Table1[date] >= PreviousQuarterStart && Table1[date] <= PreviousQuarterEnd,
Table1[Center] = Center
)
RETURN
CALCULATE(
DISTINCTCOUNT(Table1[guest code]),
FILTER(
ALL(Table1),
Table1[date] >= CurrentQuarterStart && Table1[date] <= CurrentQuarterEnd &&
Table1[guest code] IN PreviousGuest
)
)
manar_alamri
1 year agoHelper I
I tried to remove the center ( Table1[Center] = Center)
and it is work
but i need it by centers