Forum Discussion

GabinAM's avatar
GabinAM
Frequent Visitor
2 years ago
Solved

Power Querry - Replace a boolean value True or False

Hello everyone ! ğŸ˜Š

I'm trying to replace boolean values based on another column condition.However and despite the absence of error, there is no modification at all on the table (the formula works perfectly to change non boolean values).


Could you please help ? Please find the Excel document and the Pbix here

Many thanks in advance ! ğŸ™Œ

*If by any chance you also have a way to reduce the formula by avoiding "...or..." I would be very interested but I can deal with it !   

  • pls try this

    = Table.ReplaceValue(#"Changed Type",each [Direct Contact],each if List.ContainsAny({"Jodie","Anthony","Jonathan"},{[Sales]}) then false else [Direct Contact]   ,Replacer.ReplaceValue,{"Sales", "Direct Contact"})

4 Replies

  • pls try this

    = Table.ReplaceValue(#"Changed Type",each [Direct Contact],each if List.ContainsAny({"Jodie","Anthony","Jonathan"},{[Sales]}) then false else [Direct Contact]   ,Replacer.ReplaceValue,{"Sales", "Direct Contact"})
    • GabinAM's avatar
      GabinAM
      Frequent Visitor

      Hi Ahmedx it works! Just need to add one additional steps to change Data Type to Logical but otherwise, it's perfect! Many thanks for your help! Appreciate! 

    • GabinAM's avatar
      GabinAM
      Frequent Visitor

      Hello! I tried and indeed, it works on the test sample ! ğŸ˜…

      However, I think I forgot one key point... the column [Direct Contact] is Data Type = True/False and Under this format, the "false" doesn't work anymore... Please see below. 


      I updated the Pbix in the dropbox folder. here 

       
      Sorry and thank you again for you help!