Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

using Contains and multiple conditions with OR

I have below formula and I have tried DAX contains and search functions, nothing is giving desired output, please suggest.   Job Category =  IF contains([Job Group],'Materials Management') OR co...
  • zuheirashraf17's avatar
    7 years ago

    Hi Shilpi,

     

    I tested it and this should be working fine.

    Do let me know if you need further explanation for this;

     

    Category = SWITCH(TRUE(),
                        IF(SEARCH("Materials Management", [Job Group], 1, 0) > 0 || SEARCH("Distribution", [Job Group], 1, 0) > 0 || SEARCH("Distribution", [Job Group], 1, 0) > 0
                            ,TRUE()
                            ,FALSE()
                            ),"Distribution",
                        IF(SEARCH("Procurement", [Job Group], 1, 0) > 0 || SEARCH("Categories", [Job Group], 1, 0) > 0 || SEARCH("Geographic", [Job Group], 1, 0) > 0 || SEARCH("Processes", [Job Group], 1, 0) > 0
                            ,TRUE()
                            ,FALSE()
                            ),"Procurement and Sourcing",
                        IF(SEARCH("Engineering & Construction", [Job Group], 1, 0) > 0 
                            ,TRUE()
                            ,FALSE()
                            ),"Facilities",
                        "N/A"                  
    )