Forum Discussion
adoalan
3 years agoHelper III
Help with DAX Formula please
I have this piece of SQL code and I need to convert it in a DAX formula.
I got half way through it and the below is working perfectly:
TESTAGAIN =
SWITCH(
TRUE(),
ISBLANK('nfp_giftaiddeclaration'[Forename]), "Yes",
ISBLANK('nfp_giftaiddeclaration'[Surname]), "Yes",
ISBLANK('nfp_giftaiddeclaration'[House]), "Yes",
ISBLANK('nfp_giftaiddeclaration'[Postcode]), "Yes",
"No")
How ever I can't incorporate the last part with
IF(CONTAINSSTRING( nfp_giftaiddeclaration[Forename] , "&" ) || CONTAINSSTRING(nfp_giftaiddeclaration[Surname], "&" ), "Y", "N")
Somehow I m missing something here and I can't get it done. I get this error:
Can you help?
Many thanks
9 Replies
- Greg_DecklerCommunity Champion
adoalan You can use SEARCH or FIND as an equivalent for CONTAINSSTRING
- adoalanHelper III
Greg_Deckler I tried but something is not working because I cannot get any results!
- NikhilChennaSkilled Sharer
Hi adoalan ,
Please use the below i took it from your piece of example only,
TESTAGAIN =SWITCH(TRUE(),ISBLANK('nfp_giftaiddeclaration'[Forename]), "Yes",ISBLANK('nfp_giftaiddeclaration'[Surname]), "Yes",ISBLANK('nfp_giftaiddeclaration'[House]), "Yes",ISBLANK('nfp_giftaiddeclaration'[Postcode]), "Yes",CONTAINSSTRING( nfp_giftaiddeclaration[Forename] , "&" ) || CONTAINSSTRING(nfp_giftaiddeclaration[Surname], "&" ), "Yes", "No")Check if this solves the issue.Regards,Nikhil ChennaAppreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!- adoalanHelper III
NikhilChenna it doesn't work
- NikhilChennaSkilled Sharer
Hi adoalan ,
Try this out then using IF condition
IF(
ISBLANK('nfp_giftaiddeclaration'[Forename]) ||ISBLANK('nfp_giftaiddeclaration'[Surname]) ||ISBLANK('nfp_giftaiddeclaration'[House]) ||ISBLANK('nfp_giftaiddeclaration'[Postcode]) ||CONTAINSSTRING( nfp_giftaiddeclaration[Forename] , "&" ) ||CONTAINSSTRING(nfp_giftaiddeclaration[Surname], "&" ), "Yes","No")ORIF(
'nfp_giftaiddeclaration'[Forename]=BLANK() ||'nfp_giftaiddeclaration'[Surname]=BLANK() ||'nfp_giftaiddeclaration'[House]=BLANK() ||'nfp_giftaiddeclaration'[Postcode]=BLANK() ||CONTAINSSTRING( nfp_giftaiddeclaration[Forename] , "&" ) ||CONTAINSSTRING(nfp_giftaiddeclaration[Surname], "&" ), "Yes","No")This should work buddy.Regards,Nikhil ChennaAppreciate with a Kudos!! (Click the Thumbs Up Button)
Did I answer your question? Mark my post as a solution!