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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
alya1
Helper II
Helper II

Customer Number and Turnover from 1 table (customer actions)

Hello, 

I tried to simplifiy the background by using just 1 table below: 

customers actions    
customer idaction subscription tier date reason 
111activateda1/1/2021sale
222activateda4/1/2021sale
333activateda4/1/2021sale
444activatedb4/22/2021  friend
111deactivated   c4/28/2021price
555activateda5/1/2021friend
...    
111reactivatedb9/30/2023sale
...    

There are many more rows and some customers reactivate/deactivate up to 5 times. 

 

1) Is there a way to easily calcuate the customer number and turnover by year/month/day? 

 

2) I tried to look up some staff turnover guides but their data table utilitzes columns ID, start date, end date. If anyone know how I can turn the above table to below, I would greately appreciate it!

IDStart DateEnd Date
1111/1/20214/28/2021
2224/1/2021 
3334/1/2021 
4444/22/2021 
5555/1/2021 
111 (re)   9/30/2023 

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@alya1 

not sure about the first question, what's the expected output based on the sample data you provide?

 

for the second one, you can create a column

end date = if('Table'[action ]="activated",minx(FILTER('Table','Table'[customer id]=EARLIER('Table'[customer id])&&'Table'[date ]>EARLIER('Table'[date ])),'Table'[date ]))
11.PNG
 
then you can create a visual and only select activate and reactivate data.
12.PNG
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@alya1 

not sure about the first question, what's the expected output based on the sample data you provide?

 

for the second one, you can create a column

end date = if('Table'[action ]="activated",minx(FILTER('Table','Table'[customer id]=EARLIER('Table'[customer id])&&'Table'[date ]>EARLIER('Table'[date ])),'Table'[date ]))
11.PNG
 
then you can create a visual and only select activate and reactivate data.
12.PNG
 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thank you for your solution, it works! 

It appears my raw data have many missing values/issues so I will try to go about this another way for customer number and turnover. I am mainly trying to make my cleaned up table look like this: https://blog.enterprisedna.co/staff-turnover-calculation-in-power-bi-using-dax-hr-insights/

you are welcome. If you want to get the solution for another question. It's better to update the sample data and provide the expected output based on it.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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