cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
datavis Member
Member

IF and LOOKUPVALUE

I am using the following to create a column when an employee is compliant or non-compliant and it works great.

Training Compliance =
IF (
    LOOKUPVALUE ('DelinquentTraining'[Emplid],'DelinquentTraining'[Emplid],'HHS-DSHS-ActivePositions'[EmplID])
        ,
    "Non-Compliant",
    "Compliant"
)

The Training Compliance column I created (above) is in the HHS-DSHS-Active Positions table. Can I add an IF then statement to the Lookup?

 

IF HHS-DSHS-ActivePositions[Name] is Vacant then Vacant. This would replace compliant or non-compliant in Training Compliance column with Vacant. Without this my compliant noncompliant will be off.

 

Hoping this makes sense.

 

 

 

IF ('HHS-DSHS-ActivePositions'[Name] is Vacant then Vacant

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: IF and LOOKUPVALUE

Hi @datavis,

 

AFAIK, if function is a logic function, I think you need to modify lookupvalue part as logic expression.

 

Reference link:

IF Function (DAX)

 

IF(logical_test>,<value_if_true>, value_if_false)  

 

 

Sample formula:

Training Compliance =
VAR lookup =
    LOOKUPVALUE (
        'DelinquentTraining'[Emplid],
        'DelinquentTraining'[Emplid], 'HHS-DSHS-ActivePositions'[EmplID]
    )
VAR compareVaribale = xxxx
RETURN
    IF ( lookup = compareVaribale, "Non-Compliant", "Compliant" )

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |
1 REPLY 1
Community Support Team
Community Support Team

Re: IF and LOOKUPVALUE

Hi @datavis,

 

AFAIK, if function is a logic function, I think you need to modify lookupvalue part as logic expression.

 

Reference link:

IF Function (DAX)

 

IF(logical_test>,<value_if_true>, value_if_false)  

 

 

Sample formula:

Training Compliance =
VAR lookup =
    LOOKUPVALUE (
        'DelinquentTraining'[Emplid],
        'DelinquentTraining'[Emplid], 'HHS-DSHS-ActivePositions'[EmplID]
    )
VAR compareVaribale = xxxx
RETURN
    IF ( lookup = compareVaribale, "Non-Compliant", "Compliant" )

 

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.



For learning resources/Release notes, please visit: | |