Forum Discussion
DAX Expression for comparing rows
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
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-msft7 years agoResident 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