Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I am trying to implement something as shown in the picture
Segment | Last Period | Current Period | Change | Chagne % | Retained | Retention |
Decreasing Customer | 150 | 78 | -72 | -48% | 78 | 52% |
Increasing Customer | 88 | 225 | 137 | 156% | 88 | 100% |
Lost Customer | 74 | 0 | -74 | -100% | 0 | 0% |
New Customer | 0 | 76 | 76 | 0 | ||
Total | 312 | 379 | 67 | 21% | 166 | 53% |
I can get individual measures for New, count of New, Lost, ret, Increase, decrease but I am trying to display it as in the table. Any suggestions?
cnt New Customers =
VAR CurrentYear = MAX('Calendar'[YEAR])
VAR OldCustomers = CALCULATETABLE(
VALUES('Orders Combined'[NATIONAL_ACCT_NAME]),
'Calendar'[YEAR] < CurrentYear)
VAR CurrentCustomers = CALCULATETABLE(
VALUES('Orders Combined'[NATIONAL_ACCT_NAME]),
'Calendar'[YEAR] = CurrentYear)
VAR NewCustomers = EXCEPT(CurrentCustomers,OldCustomers)
RETURN COUNTROWS(NewCustomers)
cnt Lost Customers =
VAR CurrentYear = MAX('Calendar'[YEAR])
VAR OldCustomers = CALCULATETABLE(
VALUES('Orders Combined'[NATIONAL_ACCT_NAME]),
'Calendar'[YEAR] < CurrentYear)
VAR CurrentCustomers = CALCULATETABLE(
VALUES('Orders Combined'[NATIONAL_ACCT_NAME]),
'Calendar'[YEAR] = CurrentYear)
VAR LostCustomers = EXCEPT(OldCustomers,CurrentCustomers)
RETURN COUNTROWS(LostCustomers)
cnt Ret Customers =
VAR CurrentYear = MAX('Calendar'[YEAR])
VAR OldCustomers = CALCULATETABLE(
VALUES('Orders Combined'[NATIONAL_ACCT_NAME]),
'Calendar'[YEAR] < CurrentYear)
VAR CurrentCustomers = CALCULATETABLE(
VALUES('Orders Combined'[NATIONAL_ACCT_NAME]),
'Calendar'[YEAR] = CurrentYear)
VAR RetCustomers = INTERSECT(OldCustomers,CurrentCustomers)
RETURN COUNTROWS(RetCustomers)
cnt Increase in Customer = IF( [cnt Customers CY] > [cnt Old Customers] , [cnt Customers CY] - [cnt Old Customers], 0)
cnt Decrease in Customer = IF([cnt Old Customers] > [cnt Customers CY], [cnt Old Customers] - [cnt Customers CY], 0)
The one I get via Power Bi is by year. I am trying to display it as shown in the first table
Year | cnt Ret Customers | cnt New Customers | cnt Lost Customers | cnt Increase in Customer | cnt Decrease in Customer |
2017 | 4953 | 4953 | 0 | ||
2018 | 2898 | 2156 | 2055 | 101 | 0 |
Please let me know if that is even possible
Solved! Go to Solution.
@Anonymous,
You may add a separate table that contains the first column [Segment], then drag the column to Table visual, and create measures accordingly.
@Anonymous,
You may add a separate table that contains the first column [Segment], then drag the column to Table visual, and create measures accordingly.
Thank you. I did that yesterday itself but forgot to update the thread. However, I have created another post due to the update on the logic for the new lost decreasing and increasing customer. Please let me know if you could help me with the conversion of query mentioned in the new post into DAX.
User | Count |
---|---|
140 | |
113 | |
104 | |
77 | |
64 |
User | Count |
---|---|
135 | |
122 | |
101 | |
71 | |
61 |