Forum Discussion

LyonsBI_BRL's avatar
LyonsBI_BRL
Icon for Helper III rankHelper III
5 years ago
Solved

Lookup Value and Return Value if no value Present

I have an issue with a table where I need to assign a value to a row IF no data is present from the LOOKUP table. 

 

I have a calculated column for SCORE

 

Score = LOOKUPVALUE(statuses[score],statuses[RegistrantId],[RegistrantID])

I've tried writing a piece of code here to see if that would work but am running into a road block. 

Exists = IF('All Applicants - '[Score] in ALL('All Applicants - 1'[Score]),[Score],"No Score")

Any suggestions would be greatly appreaciated. 

 

Thanks!

 

  • Hi, LyonsBI_BRL 

    According to your description, I can roughly understand your requirement, I think that you can simply change the original DAX formula like this:

    Score =
    
    var _value=LOOKUPVALUE(statuses[score],statuses[RegistrantId],[RegistrantID])
    
    return
    
    IF(_value<>BLANK(),FORMAT(_value,""),"No score")

     

    And you can get what you want, like this:

     

    You can download my test pbix file below

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Can you add a model relationship? If so you can just go COALESCE(RELATED('lookuptable' [column]), "my alternative value") 

  • Anonymous 

    Awesome idea! Just tried it though I'm getting this below

     

  • v-robertq-msft's avatar
    v-robertq-msft
    Icon for Community Support rankCommunity Support

    Hi, LyonsBI_BRL 

    According to your description, I can roughly understand your requirement, I think that you can simply change the original DAX formula like this:

    Score =
    
    var _value=LOOKUPVALUE(statuses[score],statuses[RegistrantId],[RegistrantID])
    
    return
    
    IF(_value<>BLANK(),FORMAT(_value,""),"No score")

     

    And you can get what you want, like this:

     

    You can download my test pbix file below

     

    If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

    How to Get Your Question Answered Quickly 

    Thank you very much!

     

    Best Regards,

    Community Support Team _Robert Qin

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