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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Varshi288
Resolver I
Resolver I

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.  

 

new cust.PNG    

PLease help  thanks inadvance.

 

3 REPLIES 3
v-piga-msft
Resident Rockstar
Resident 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

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

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.

Year201720182019
CustomerKUSDNew CustKUSDVs PrY%New CustKUSDVs PrY%New Cust
Abc1232989New Customer2922-2% 2453-16% 
Abc1241268New Customer159426% 15940% 
Abc1251291New Customer13333% 1110-17% 
Abc1261083New Customer151039% 654-57%Lost Customer
Abc127 New Customer974 New Customer792-19% 
Abc128-72New Customer1211-1779%Lost Customer1169-3% 
Abc129396New Customer47821% 81671% 
Abc1301157New Customer410-65%Lost Customer79-81%Lost Customer
Abc131     600 New Customer

 

BR

Varshi

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

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.