Forum Discussion

rwoodward's avatar
rwoodward
Frequent Visitor
1 year ago
Solved

Pulling Text Data if Multiple Conditions Are Met DAX Help

I am working with text data and need help creating the DAX. Using the example data below. I am looking to create a DAX that gives me the text data in Column2 under these conditions: If Column1 has du...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi rwoodward ,

    I create a table and an Index column.

    Then I create a calculated column and here is the DAX code.

    Column = 
    VAR _Column =
        IF (
            'Table'[Column2] = "Yes",
            "Yes",
            IF (
                'Table'[Column2] = "No"
                    && CALCULATE (
                        COUNTROWS ( 'Table' ),
                        ALLEXCEPT ( 'Table', 'Table'[Column1] ),
                        'Table'[Column2] = "Yes"
                    ) = 0,
                "No",
                BLANK ()
            )
        )
    VAR RankNo =
        RANKX (
            FILTER (
                'Table',
                'Table'[Column1] = EARLIER ( 'Table'[Column1] )
                    && _Column = "No"
            ),
            'Table'[Index],
            ,
            ASC,
            DENSE
        )
    RETURN
        IF ( _Column = "No" && RankNo > 1, BLANK (), _Column )

     

     

    Best Regards

    Yilong Zhou

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