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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Saxon10
Post Prodigy
Post Prodigy

Switch true multiple columns and criteria

Hi,

 

DATA (FROM A TO I)

 

COUNTORY - UK & ENG Contain three different status which is "Matched",Not Required" and "Not Matched"

 

COUNTORY - US,INDIA,SA,PAK,SRL,AFG & BAN Contain two different status are "Matched" and "Not Matched"

 

STATUS - Completed and Incompleted

 

RULE:

 

1.If status column J is "Incompleted" andcolumn A to I find "Not Matched" then return the columns headers with coma.

 

2.If status column J is "Completed" and column A to I find "Matched" and "Not Required" then return is "Oky"

 

Column K is final result (please refer the snapshot). I am looking for New calculated option.

 

UKUSINDIASASRLPAKBANAFGENGSTATUSRESULT
MATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT REQUIREDCOMPLETEDOKY
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT REQUIREDCOMPLETEDOKY
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDCOMPLETEDOKY
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDPAK,BAN
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDBAN
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDNOT REQUIREDNOT COMPLETEDBAN,AFG
NOT REQUIREDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDNOT MATCHEDNOT REQUIREDNOT COMPLETEDINDIA,PAK,BAN,AFG
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDNOT MATCHEDNOT COMPLETEDBAN,AFG,ENG
NOT REQUIREDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDINDIA,PAK,BAN
NOT REQUIREDNOT MATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDNOT MATCHEDNOT REQUIREDNOT COMPLETEDUS,INDIA,PAK,BAN,AFG
NOT REQUIREDNOT MATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDUS,INDIA,PAK
NOT REQUIREDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDINDIA,PAK
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT MATCHEDNOT COMPLETEDBAN,ENG
NOT REQUIREDNOT MATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDUS,INDIA,PAK,BAN
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT REQUIREDNOT COMPLETEDAFG
NOT REQUIREDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDNOT MATCHEDMATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDSA,SRL,PAK
NOT REQUIREDNOT MATCHEDNOT MATCHEDNOT MATCHEDNOT MATCHEDNOT MATCHEDMATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDUS,INDIA,SA,SRL,PAK
NOT REQUIREDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDNOT COMPLETEDINDIA,PAK,ENG
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDMATCHEDNOT COMPLETEDPAK
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDPAK
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT COMPLETEDENG
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDNOT MATCHEDNOT REQUIREDNOT COMPLETEDPAK,BAN,AFG
NOT REQUIREDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDSA
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT COMPLETEDBAN
NOT REQUIREDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT MATCHEDNOT MATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDSA,PAK,BAN
NOT REQUIREDMATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDSA,BAN
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT MATCHEDMATCHEDNOT COMPLETEDPAK,AFG
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT COMPLETEDAFG
NOT REQUIREDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT MATCHEDMATCHEDMATCHEDNOT REQUIREDNOT COMPLETEDSA,PAK
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDMATCHEDNOT MATCHEDNOT REQUIREDNOT COMPLETEDPAK,AFG
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDMATCHEDMATCHEDNOT COMPLETEDPAK,BAN
NOT REQUIREDMATCHEDMATCHEDMATCHEDMATCHEDNOT MATCHEDNOT MATCHEDMATCHEDNOT MATCHEDNOT COMPLETEDPAK,BAN,ENG

 

 

Capture2.PNG

1 ACCEPTED SOLUTION

HI @Saxon10 

Us ethe below I have verified. Don't forget to "Accept it as Solution"

_Result = 
// 1.If status column J is "Incompleted" andcolumn A to I find "Not Matched" then return columns headers with coma.
// 2.If status column J is "Completed" and column A to I find "Matched" and "Not Required" then return is "Oky"
VAR _uk = IF('Table'[UK] = "MATCHED",1,0)
VAR _us = IF('Table'[US] = "MATCHED",1,0)
VAR _in = IF('Table'[INDIA] = "MATCHED",1,0)
VAR _sa = IF('Table'[SA] = "MATCHED",1,0)
VAR _sl = IF('Table'[SRL] = "MATCHED",1,0)
VAR _pa = IF('Table'[PAK] = "MATCHED",1,0)
VAR _ba = IF('Table'[BAN] = "MATCHED",1,0)
VAR _af = IF('Table'[AFG] = "MATCHED",1,0)

VAR __uk = IF('Table'[UK] = "NOT MATCHED",1,0)
VAR __us = IF('Table'[US] = "NOT MATCHED",1,0)
VAR __in = IF('Table'[INDIA] = "NOT MATCHED",1,0)
VAR __sa = IF('Table'[SA] = "NOT MATCHED",1,0)
VAR __sl = IF('Table'[SRL] = "NOT MATCHED",1,0)
VAR __pa = IF('Table'[PAK] = "NOT MATCHED",1,0)
VAR __ba = IF('Table'[BAN] = "NOT MATCHED",1,0)
VAR __af = IF('Table'[AFG] = "NOT MATCHED",1,0)
VAR __en = IF('Table'[ENG] = "NOT MATCHED",1,0)

VAR Val = SWITCH(TRUE(),
              'Table'[STATUS] = "COMPLETED",
                    IF(_uk+_us+_in+_sa+_sl+_pa+_ba+_af > 0 || 'Table'[ENG] = "NOT REQUIRED" ,"OKY",""),
              'Table'[STATUS] = "NOT COMPLETED",
                    IF(__uk=1,"UK","") & IF(__us=1,",US","") & IF(__in=1,",IND","") & IF(__SA=1,",SA","") & IF(__SA=1,",SA","") & IF(__sl=1,",SRL","") & IF(__pa=1,",PAK","") & IF(__ba=1,",BAN","") & IF(__af=1,",AFG","") & IF(__en=1,",END","")
       )
RETURN IF(SEARCH(",",Val,1,0) > 0,SUBSTITUTE(val,",","",1),val)




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

5 REPLIES 5
pranit828
Community Champion
Community Champion

Hi @Saxon10 

Create a new column using the below DAX, it should resolve your issue.

_Result = 
// 1.If status column J is "Incompleted" andcolumn A to I find "Not Matched" then return columns headers with coma.
// 2.If status column J is "Completed" and column A to I find "Matched" and "Not Required" then return is "Oky"
VAR _uk = IF('Table'[UK] = "MATCHED",1,0)
VAR _us = IF('Table'[US] = "MATCHED",1,0)
VAR _in = IF('Table'[INDIA] = "MATCHED",1,0)
VAR _sa = IF('Table'[SA] = "MATCHED",1,0)
VAR _sl = IF('Table'[SRL] = "MATCHED",1,0)
VAR _pa = IF('Table'[PAK] = "MATCHED",1,0)
VAR _ba = IF('Table'[BAN] = "MATCHED",1,0)
VAR _af = IF('Table'[AFG] = "MATCHED",1,0)

VAR __uk = IF('Table'[UK] = "NOT MATCHED",1,0)
VAR __us = IF('Table'[US] = "NOT MATCHED",1,0)
VAR __in = IF('Table'[INDIA] = "NOT MATCHED",1,0)
VAR __sa = IF('Table'[SA] = "NOT MATCHED",1,0)
VAR __sl = IF('Table'[SRL] = "NOT MATCHED",1,0)
VAR __pa = IF('Table'[PAK] = "NOT MATCHED",1,0)
VAR __ba = IF('Table'[BAN] = "NOT MATCHED",1,0)
VAR __af = IF('Table'[AFG] = "NOT MATCHED",1,0)
VAR __en = IF('Table'[ENG] <> "NOT MATCHED",1,0)

VAR Val = SWITCH(TRUE(),
              'Table'[STATUS] = "COMPLETED",
                    IF(_uk+_us+_in+_sa+_sl+_pa+_ba+_af > 0 || 'Table'[ENG] = "NOT REQUIRED" ,"OKY",""),
              'Table'[STATUS] = "NOT COMPLETED",
                    IF(__uk=1,"UK","") & IF(__us=1,",US","") & IF(__in=1,",IND","") & IF(__SA=1,",SA","") & IF(__SA=1,",SA","") & IF(__sl=1,",SRL","") & IF(__pa=1,",PAK","") & IF(__ba=1,",BAN","") & IF(__af=1,",AFG","") & IF(__en=1,",END","")
       )
RETURN IF(SEARCH(",",Val,1,0) > 0,SUBSTITUTE(val,",","",1),val)




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Thanks for your reply.

It's almost working but some of the column not giving correct result. Please refer the snapshot.

 

Saxon10_0-1616661020439.png

 

 

HI @Saxon10 

Us ethe below I have verified. Don't forget to "Accept it as Solution"

_Result = 
// 1.If status column J is "Incompleted" andcolumn A to I find "Not Matched" then return columns headers with coma.
// 2.If status column J is "Completed" and column A to I find "Matched" and "Not Required" then return is "Oky"
VAR _uk = IF('Table'[UK] = "MATCHED",1,0)
VAR _us = IF('Table'[US] = "MATCHED",1,0)
VAR _in = IF('Table'[INDIA] = "MATCHED",1,0)
VAR _sa = IF('Table'[SA] = "MATCHED",1,0)
VAR _sl = IF('Table'[SRL] = "MATCHED",1,0)
VAR _pa = IF('Table'[PAK] = "MATCHED",1,0)
VAR _ba = IF('Table'[BAN] = "MATCHED",1,0)
VAR _af = IF('Table'[AFG] = "MATCHED",1,0)

VAR __uk = IF('Table'[UK] = "NOT MATCHED",1,0)
VAR __us = IF('Table'[US] = "NOT MATCHED",1,0)
VAR __in = IF('Table'[INDIA] = "NOT MATCHED",1,0)
VAR __sa = IF('Table'[SA] = "NOT MATCHED",1,0)
VAR __sl = IF('Table'[SRL] = "NOT MATCHED",1,0)
VAR __pa = IF('Table'[PAK] = "NOT MATCHED",1,0)
VAR __ba = IF('Table'[BAN] = "NOT MATCHED",1,0)
VAR __af = IF('Table'[AFG] = "NOT MATCHED",1,0)
VAR __en = IF('Table'[ENG] = "NOT MATCHED",1,0)

VAR Val = SWITCH(TRUE(),
              'Table'[STATUS] = "COMPLETED",
                    IF(_uk+_us+_in+_sa+_sl+_pa+_ba+_af > 0 || 'Table'[ENG] = "NOT REQUIRED" ,"OKY",""),
              'Table'[STATUS] = "NOT COMPLETED",
                    IF(__uk=1,"UK","") & IF(__us=1,",US","") & IF(__in=1,",IND","") & IF(__SA=1,",SA","") & IF(__SA=1,",SA","") & IF(__sl=1,",SRL","") & IF(__pa=1,",PAK","") & IF(__ba=1,",BAN","") & IF(__af=1,",AFG","") & IF(__en=1,",END","")
       )
RETURN IF(SEARCH(",",Val,1,0) > 0,SUBSTITUTE(val,",","",1),val)




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

Thanks for your reply and help. It's working now and I like your logic.

 

 

Hi,

 

Thanks for your reply and help. Can you please share your output file because I am receiving error.

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.