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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
pbianalyst
New Member

Create A Custom Column with and IF Statement that references values in a separate table.

Good afternoon, 

I have a table with 25 columns to identify different diagnosis codes. I would like to create a custom column that flags whether any of the diagnosis codes (180) in another table are in any of those 25 fields. Is there a DAX statement or any other way that can help me accomplish that task in Power BI?

Thanks in advance for your help!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Trying to flag the Trigger Diags sounds like?  Something along these lines should work.  You would add this as a calculated column on the Claim table.

 

Trigger_Diagnosis = 
SWITCH (
    TRUE(),
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code1] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code2] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code3] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code4] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code5] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code6] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code7] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code8] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code9] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code10] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code11] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code12] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code13] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code14] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code15] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code16] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code17] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code18] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code19] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code20] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code21] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code22] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code23] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code24] ) ), "Y"
    )

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @pbianalyst ,


Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your problem.


Best Regards,
Stephen Tao

jdbuchanan71
Super User
Super User

Trying to flag the Trigger Diags sounds like?  Something along these lines should work.  You would add this as a calculated column on the Claim table.

 

Trigger_Diagnosis = 
SWITCH (
    TRUE(),
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code1] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code2] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code3] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code4] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code5] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code6] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code7] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code8] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code9] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code10] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code11] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code12] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code13] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code14] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code15] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code16] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code17] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code18] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code19] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code20] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code21] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code22] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code23] ) ), "Y",
    NOT ISBLANK ( LOOKUPVALUE ( Trigger_Diag[Diagnostic_Code], Trigger_Diag[Diagnostic_Code], Claim[Diagnostic_Code24] ) ), "Y"
    )

 

 

Thanks so much for your help and quick response. I will definetely try your solution.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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