Forum Discussion

powerbiuser365's avatar
powerbiuser365
New Member
2 years ago
Solved

Need help with column

Hi All,   I wanted to see a user has changed the status or not and have a new column Status for True Values. Sample Data User Product T/F Number A1 SC FALSE 1 A1 SC FALSE 3 A...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi powerbiuser365 ,

    You can create a calculated column as below to get it, please find the details in the attachment.

    Status = 
    VAR _count =
        CALCULATE (
            COUNT ( 'Table'[Product] ),
            FILTER (
                'Table',
                'Table'[User] = EARLIER ( 'Table'[User] )
                    && 'Table'[Product] = EARLIER ( 'Table'[Product] )
            )
        )
    VAR _maxfalse =
        CALCULATE (
            MAX ( 'Table'[Number] ),
            FILTER (
                'Table',
                'Table'[User] = EARLIER ( 'Table'[User] )
                    && 'Table'[Product] = EARLIER ( 'Table'[Product] )
                    && 'Table'[T/F] = FALSE ()
            )
        )
    RETURN
        IF (
            'Table'[T/F] = TRUE (),
            IF ( _count = 1, "Neutral", IF ( 'Table'[Number] <= _maxfalse, "No", "Yes" ) ),
            BLANK ()
        )

    Best Regards