Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

How can I create a new column based on the condition using group by column.

I have a table in which I need to check the condition if 0 appears for a country in the "dq_status_copy" column then the new column also has 0 for the specific country. If all the value inside the "d...
  • v-yanjiang-msft's avatar
    4 years ago

    Hi Anonymous ,

    According to your description, here's my solution, create a calculated column.

    DQ Test =
    IF (
        COUNTROWS (
            FILTER (
                'DQ Log',
                'DQ Log'[country_code] = EARLIER ( 'DQ Log'[country_code] )
                    && 'DQ Log'[dq_status_copy] = 0
            )
        ) > 0,
        0,
        1
    )
    

    Get the result.

    I attach my sample below for your reference.

     

    Best Regards,
    Community Support Team _ kalyj

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