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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
krichmond
Helper IV
Helper IV

Need help adding criteria to existing DAX formula.

I have this DAX statement that works but I need to add a second piece of criteria to row 10. I need to have both "Missing Media" OR "Reprocess File".

 

Has Missing Media? =
var _Column=
SELECTCOLUMNS(
    FILTER(ALL('Client Manager Report For Power BI'),'Client Manager Report For Power BI'[Event Id]=EARLIER('Client Manager Report For Power BI'[Event Id])),"1",'Client Manager Report For Power BI'[DBM Stage])
var _falg=
    CALCULATE(
    DISTINCTCOUNT('Client Manager Report For Power BI'[DBM Stage]),FILTER(ALL('Client Manager Report For Power BI'),'Client Manager Report For Power BI'[Event Id]=EARLIER('Client Manager Report For Power BI'[Event Id])))
return
IF(
    _falg =1 && "Missing Media" in _Column,TRUE(),FALSE())

 

Screenshot 2023-01-26 070144.png

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

I think you can use

Has Missing Media? =
VAR _Column =
    SELECTCOLUMNS (
        FILTER (
            ALL ( 'Client Manager Report For Power BI' ),
            'Client Manager Report For Power BI'[Event Id]
                = EARLIER ( 'Client Manager Report For Power BI'[Event Id] )
        ),
        "1", 'Client Manager Report For Power BI'[DBM Stage]
    )
VAR _falg =
    CALCULATE (
        DISTINCTCOUNT ( 'Client Manager Report For Power BI'[DBM Stage] ),
        FILTER (
            ALL ( 'Client Manager Report For Power BI' ),
            'Client Manager Report For Power BI'[Event Id]
                = EARLIER ( 'Client Manager Report For Power BI'[Event Id] )
        )
    )
RETURN
    IF (
        _falg = 1
            && ( "Missing Media"
            IN _Column
            || "Reprocess File" IN _Column ),
        TRUE (),
        FALSE ()
    )

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

I think you can use

Has Missing Media? =
VAR _Column =
    SELECTCOLUMNS (
        FILTER (
            ALL ( 'Client Manager Report For Power BI' ),
            'Client Manager Report For Power BI'[Event Id]
                = EARLIER ( 'Client Manager Report For Power BI'[Event Id] )
        ),
        "1", 'Client Manager Report For Power BI'[DBM Stage]
    )
VAR _falg =
    CALCULATE (
        DISTINCTCOUNT ( 'Client Manager Report For Power BI'[DBM Stage] ),
        FILTER (
            ALL ( 'Client Manager Report For Power BI' ),
            'Client Manager Report For Power BI'[Event Id]
                = EARLIER ( 'Client Manager Report For Power BI'[Event Id] )
        )
    )
RETURN
    IF (
        _falg = 1
            && ( "Missing Media"
            IN _Column
            || "Reprocess File" IN _Column ),
        TRUE (),
        FALSE ()
    )
TomasAndersson
Solution Sage
Solution Sage

Hi!
Have you tried just wrapping in an OR() statement? E.g.:

OR("Missing Media" in _Column, "Reproess file" in _Column)

 

@TomasAndersson - I am extremely new to DAX so I am not quite sure how to do that. Any chance you can send me what the modified line of code should look like? I tried the below and got this error.

 

Screenshot 2023-01-26 081735.png

Sure,

 

 

_falg = 1 OR("Missing Media" in _Column, "Reprocess file" in _Column), TRUE(), FALSE())

 

 

So you need to have the "in _Column" in both cases

 

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

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