Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

New, Lost, Retained, Increase and Decrease Customers

I am trying to implement something as shown in the picture

SegmentLast PeriodCurrent PeriodChangeChagne %RetainedRetention
Decreasing Customer15078-72-48%7852%
Increasing Customer88225137156%88100%
Lost Customer740-74-100%00%
New Customer07676 0 
Total3123796721%16653%

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

Yearcnt Ret Customerscnt New Customerscnt Lost Customerscnt Increase in Customercnt Decrease in Customer
2017 4953 49530
20182898215620551010

 

Please let me know if that is even possible

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may add a separate table that contains the first column [Segment], then drag the column to Table visual, and create measures accordingly.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous,

 

You may add a separate table that contains the first column [Segment], then drag the column to Table visual, and create measures accordingly.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

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.


https://community.powerbi.com/t5/Desktop/new-lost-customers-based-on-current-and-last-year-volume/m-...

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.