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
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
v-stephen-msft
Community Support
Community Support

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.