Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
DMB90
Helper I
Helper I

DAX Formula - Finding Any Row in a Column that contains a certain value

I have a table in Power BI that contains the same values multiple times in a column, but I want to create a formula that says if any row in the column contains the same Control Name, and Status is equal to "Complete-Fail" and Discussed is equal to "Discussed with Mgmt" then make my new Effective/Ineffective column say "Ineffective", if not then "Effective" is returned. Keep in mind, every control will not have the same number of phases and not everything with a "Complete-Fail" status is Discussed with Mgmt. If you took, my sample data, I would only expect to see "Ineffective" for rows that say "Complete-Fail" and "Discussed with Mgmt."

 

Every control will have a Walkthrough phase while the other phases for each control will vary, so perhaps a formula can be built around if the control contains string "Complete" for the Walkthrough phase of a control, to find just one for that control that may contain "Complete-Fail" and "Discussed with Mgmt" for the Ineffective status. 

 

EffectiveIneffectiveScreenshot.png

1 ACCEPTED SOLUTION

Hi,

Please check the below image and the attached pbix file.

Or, please draw how the expected result looks like.

 

Jihwan_Kim_0-1741665303198.png

 

effective/ineffective CC =
VAR _condition =
    COUNTROWS (
        FILTER (
            data,
            data[control name] = EARLIER ( data[control name] )
                && data[status] = "complete-fail"
                && data[discussed] = "discussed with Mgmt"
        )
    ) >= 1
RETURN
    IF ( _condition, "ineffective", "effective" )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

6 REPLIES 6
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

It is for creating a calcualted column.

 

Jihwan_Kim_0-1741579308710.png

 

effective/ineffective CC = 
VAR _condition = data[status] = "complete-fail"
    && data[discussed] = "discussed with Mgmt"
RETURN
    IF ( _condition, "ineffective", "effective" )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Thank you, but for example, CBT-05 has one phase with Complete-Fail and Discussed with Mgmt, so I want every line that says CBT-05 to read as Ineffective or just use the Walkthrough phase row only to look at every phase for each control and put Effective/Ineffective on the walkthrough phase row (based on all phases) since every control has a walkthrough phase.

Hi,

Please check the below image and the attached pbix file.

Or, please draw how the expected result looks like.

 

Jihwan_Kim_0-1741665303198.png

 

effective/ineffective CC =
VAR _condition =
    COUNTROWS (
        FILTER (
            data,
            data[control name] = EARLIER ( data[control name] )
                && data[status] = "complete-fail"
                && data[discussed] = "discussed with Mgmt"
        )
    ) >= 1
RETURN
    IF ( _condition, "ineffective", "effective" )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

This resolved it. Thank you!

Deku
Continued Contributor
Continued Contributor

 

 

var controlName = datum[Control Name]
var ineffective = 
FILTER(
   ALL( datum ),
   datum[Control Name] =  controlName 
   && datum[Status] =     "Complete-Fail"
   && datum[Discussed] =  "Discussed with Mgmt"
)
return
IF( ISEMPTY( ineffective ), "Effective", "Ineffective" )

 

 

I tried using the formula, but received an error.

 

DMB90_0-1741630690947.png

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.