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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
CarlsBerg999
Helper V
Helper V

Multiple and's in a calculated column

Hi,

 

I have a dataset where i want to classify each row based on a few criteria. 

If Customer previously exists in the data AND

the customer has signed a contract 

Then "value1"

 

How do i write something like this in dax? Is the first one something like:
IF(

VAR CurrentRowCustomer ID = 'Table1'[CustomerID]
Return

COUNTROWS(FILTER('Table1','Table1'[CustomerID]=CurrentRowCustomerID)) > 1, "old customer", "new customer")

This seems like rather long DAX query.. any ideas on what DAX functions to use?

 

1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @CarlsBerg999 ,

 

According to your judgment, I did the following test:

M =
VAR cur_id =
    MAX ( Table1[Customer ID] )
RETURN
    IF (
        MAX ( Table1[LAST_status] ) = 1
            && MAX ( Table2[Customer] ) = cur_id,
        "old customer",
        "new customer"
    )

 

v-henryk-mstf_0-1619517258631.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

 

Best Regards,
Henry

 

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

3 REPLIES 3
v-henryk-mstf
Community Support
Community Support

Hi @CarlsBerg999 ,

 

According to your judgment, I did the following test:

M =
VAR cur_id =
    MAX ( Table1[Customer ID] )
RETURN
    IF (
        MAX ( Table1[LAST_status] ) = 1
            && MAX ( Table2[Customer] ) = cur_id,
        "old customer",
        "new customer"
    )

 

v-henryk-mstf_0-1619517258631.png


If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

 

Best Regards,
Henry

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-henryk-mstf
Community Support
Community Support

Hi @CarlsBerg999 ,

 

According to your request, this does not seem to be very difficult. But I can't know the specific data model, and can't make accurate tests. Can you provide detailed information or data model so that I can answer for you as soon as possible.


Let me know immediately, looking forward to your reply.

Best Regards,
Henry

amitchandak
Super User
Super User

@CarlsBerg999 , This can be done based on date or index column

 

if( minx(filter(table, [customer] =earlier([customer])),[Date]) =[Date],"New customer" , "old customer")

 

if no date then add index column https://stackoverflow.com/questions/45715963/creating-an-index-column-for-power-bi

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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