Forum Discussion

Creative_tree88's avatar
1 year ago
Solved

Finding a match in multiple fields

Hi all - I've attached some sample data which I'm hoping you'll be able to help me with!  There are essentially 2 tables.  The first one looks at activity and pulls everything associated with each US...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi Creative_tree88,

     

    Thank you for reaching out to the Microsoft Fabric Forum Community.

    Please try the fallowing dax to create calculated column in activity table.

    Validity Check =
    VAR UserID = Activity[USER_ID]
    VAR Modality = Activity[MODALITY]
    VAR PermittedModalities =
    ", " & SUBSTITUTE(
    LOOKUPVALUE(UserModalities[MODALITIES], UserModalities[USERID], UserID),
    ",", ", "
    ) & ","
    VAR ModalityCheck = ", " & Modality & ","
    RETURN
    IF (
    SEARCH(
    ModalityCheck,
    PermittedModalities,
    1,
    0
    ) > 0,
    "OK",
    "NOT VALID"
    )

    I’ve attempted to recreate the scenario using sample data.

    If you find this response helpful, please consider marking it as the accepted solution and giving it a thumbs-up to support others in the community.

    Thank you & regards,
    Prasanna Kumar