Forum Discussion

sree13579's avatar
sree13579
New Member
1 year ago
Solved

Conditional formatting for power query

I am trying to write a conditional column as below:

if([Final Bucket Ids]<>[Initial Bucket Id] && List.ContainsAny([Final Bucket Ids],'440','441','442','443'),1,0)

My goal is if the value in Final Bucket id is NOT equal to value in Initial Bucket id AND if the Final bucket ID is any of the following IDs - 440,441,442,443, then return me 1 else 0

Can you please help

  • if [Final Bucket Ids]<>[Initial Bucket Id] and List.ContainsAny([Final Bucket Ids], {"440","441","442","443"}) then 1 else 0

9 Replies

  • if [Final Bucket Ids]<>[Initial Bucket Id] and List.ContainsAny([Final Bucket Ids], {"440","441","442","443"}) then 1 else 0
  • the_BI_buddy's avatar
    the_BI_buddy
    Frequent Visitor

    Try:
    if Text.Lower([Final Bucket Ids]) <> Text.Lower([Initial Bucket Id]) and
    List.Contains({440, 441, 442, 443}, [Final Bucket Ids])
    then 1
    else 0

    Note: Power Query is case-sensitive, so it's always a good idea to validate the data before applying transformations.

    • sree13579's avatar
      sree13579
      New Member

      Thank you for helping me learn power BI query , this is also super helpful

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi sree13579,

        Just following up to your previous message, I'd like to confirm if you've successfully resolved this issue or if you need further help.

        If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution.


        If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you.
        Thank you for your patience and look forward to hearing from you.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi sree13579,

    Thanks for reaching out to the Microsoft fabric community forum.

    It looks like you are looking for a way to calculate if the value in Final Bucket ID is notequal to value in Initial Bucket ID and if the Final bucket ID is any of the mentioned IDs. As the_BI_buddy and ZhangKun both responded to your query, please go through their responses and check if it solves your issue.

     

    I would also take a moment to thank the_BI_buddy and ZhangKun, for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.

     

    If I misunderstand your needs or you still have problems on it, please feel free to let us know.  

    Best Regards,
    Hammad.
    Community Support Team

     

    If this post helps then please mark it as a solution, so that other members find it more quickly.

    Thank you.