Forum Discussion
DAX Expression for comparing rows
Hi all,
I need to find new customers and Lost Customers(region) based on some condition. Below is table and condition.
I need to categories region based on below condition.
If previous full year sales= 0 (sales L2y) OR
Previous sales > 100% AND previous yes sales is <100 KUSD
Then current year YTD is : New customer else Lost Customers.
PLease help thanks inadvance.
3 Replies
- v-piga-msftResident Rockstar
Hi Varshi288,
Based on your logic, we could use the IF function to create a calculated column or measure to achieve your requirement.
current year YTD = IF ( 'TableName'[previous full year sales] = 0 || 'TableName'[Previous sales] > 0.1 && 'TableName'[previous yes sales] < 100, "New customer", "Lost Customers" )If you still need help, please share some data sample as table format and your desired output so that I can copy and test to get the solution more quickly.
Best Regards,
Cherry
- Varshi288Resolver II
Hi Cherry,
Thanks for your help and appolagies for late reply since I was working with other stuff.
The logic used here is getting all as new customers (old customers also). here is som rough data alog with required out put.
Year 2017 2018 2019 Customer KUSD New Cust KUSD Vs PrY% New Cust KUSD Vs PrY% New Cust Abc123 2989 New Customer 2922 -2% 2453 -16% Abc124 1268 New Customer 1594 26% 1594 0% Abc125 1291 New Customer 1333 3% 1110 -17% Abc126 1083 New Customer 1510 39% 654 -57% Lost Customer Abc127 New Customer 974 New Customer 792 -19% Abc128 -72 New Customer 1211 -1779% Lost Customer 1169 -3% Abc129 396 New Customer 478 21% 816 71% Abc130 1157 New Customer 410 -65% Lost Customer 79 -81% Lost Customer Abc131 600 New Customer BR
Varshi
- v-piga-msftResident Rockstar
Hi Varshi288 ,
Sorry I still have a little confused about your scenario.
Could you share your sample data and the desired output in different table format so that it will be clear for us to identify which is the output you want?
The logic used here is getting all as new customers (old customers also).
In addition, your logic is not very clear based your reply. Could you please explain your logic in more details?
Best Regards,
Cherry