Forum Discussion

prj102's avatar
prj102
Helper I
6 years ago
Solved

Calculated column based on multiple rows and checking results.

I'm looking for a calculated column function that will help me determine an overall status based on multiple rows of data.   My data looks something like this and I am looking to create the "Calcula...
  • v-chuncz-msft's avatar
    v-chuncz-msft
    6 years ago

    prj102 

     

    You may try the DAX below.

    Column =
    SWITCH (
        TRUE (),
        ISEMPTY (
            FILTER (
                'Table',
                'Table'[Name] = EARLIER ( 'Table'[Name] )
                    && 'Table'[Status] <> "Passed"
            )
        ), "Passed",
        NOT (
            ISEMPTY (
                FILTER (
                    'Table',
                    'Table'[Name] = EARLIER ( 'Table'[Name] )
                        && 'Table'[Status] = "Failed"
                )
            )
        ), "Failed",
        NOT (
            ISEMPTY (
                FILTER (
                    'Table',
                    'Table'[Name] = EARLIER ( 'Table'[Name] )
                        && 'Table'[Status] = "Warning"
                )
            )
        ), "Warning"
    )