Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

True/False column based off other rows in a table

hello

 

I would like to create a column that gives a TRUE/FALSE result when looking at matching criteria in other rows in a table.

 

I would like to check if a USER_ID, LOCATION_ID & DATE match. The Result would look like the below table. Rows 1 & 2 have the same criteria, so the answer is TRUE

 

Thanks

 

USER_IDLOCATION_IDDATETRUE/FALSE
1501/01/2022TRUE
1501/01/2022TRUE
3301/01/2022FALSE
4301/01/2022FALSE
  • Hi Anonymous ,

     

    Please create a column as below:-

    TRUE/FALSE = 
    VAR result =
        COUNTROWS (
            FILTER (
                'Table (4)',
                'Table (4)'[USER_ID] = EARLIER ( 'Table (4)'[USER_ID] )
                    && 'Table (4)'[LOCATION_ID] = EARLIER ( 'Table (4)'[LOCATION_ID] )
                    && 'Table (4)'[DATE] = EARLIER ( 'Table (4)'[DATE] )
            )
        )
    RETURN
        IF ( result > 1, TRUE (), FALSE () )

    Output;-

     

    Thanks,

    Samarth

     

2 Replies

  • Samarth_18's avatar
    Samarth_18
    Community Champion

    Hi Anonymous ,

     

    Please create a column as below:-

    TRUE/FALSE = 
    VAR result =
        COUNTROWS (
            FILTER (
                'Table (4)',
                'Table (4)'[USER_ID] = EARLIER ( 'Table (4)'[USER_ID] )
                    && 'Table (4)'[LOCATION_ID] = EARLIER ( 'Table (4)'[LOCATION_ID] )
                    && 'Table (4)'[DATE] = EARLIER ( 'Table (4)'[DATE] )
            )
        )
    RETURN
        IF ( result > 1, TRUE (), FALSE () )

    Output;-

     

    Thanks,

    Samarth