Forum Discussion

gwoodley's avatar
gwoodley
Frequent Visitor
1 year ago
Solved

Check if Dates are same, but only when another column value exists in another column.

Hi, I'm a little stuck here, I'm trying to compare a date column to see if the dates are the same, but only if a value in a one column first exists in another column.

 

All columns are on the same table.

 

Example

 

Step 1 - I want to see if the value in Parent Order# column exists in Order# column.

Step 2 - If it does I want to see if the Dates are the same.

Step 3 - Add a new column called match with Yes or No.

 

 

Order#Parent Order#DateMatch 
A12345 02/07/2025No
A12346A1234502/07/2025Yes
A12347B1234602/01/2025Yes
A12348 02/04/2025No
B12345A1234502/08/2025No
B12346 02/01/2025No
B12347 02/04/2025No
B12348A1234502/04/2025No
c12345 02/04/2025No
c12346 02/04/2025No
c12347B1234602/01/2025Yes
c12348 02/04/2025No
  • gwoodley,

     

    Try this calculated column:

     

    Match = 
    VAR vParentOrder = 'Table'[Parent Order#]
    VAR vDate = 'Table'[Date]
    VAR vTable =
        FILTER (
            'Table',
            'Table'[Order#] = vParentOrder
                && 'Table'[Date] = vDate
        )
    VAR vResult =
        IF ( ISEMPTY ( vTable ), "No", "Yes" )
    RETURN
        vResult

     

     

2 Replies

  • gwoodley,

     

    Try this calculated column:

     

    Match = 
    VAR vParentOrder = 'Table'[Parent Order#]
    VAR vDate = 'Table'[Date]
    VAR vTable =
        FILTER (
            'Table',
            'Table'[Order#] = vParentOrder
                && 'Table'[Date] = vDate
        )
    VAR vResult =
        IF ( ISEMPTY ( vTable ), "No", "Yes" )
    RETURN
        vResult