• Jeff Moden (1/19/2016)


    Jacob Wilkins (1/19/2016)


    Eirikur Eiriksson (1/19/2016)


    aaron.reese (1/19/2016)


    @Jacob and @jeff

    SSRS is not my natural home 😀 so I was not aware that IIF(x AND y) is a bitwise operation. Maybe I wasn't asking google the right question but I never came across that as a solution to checking the bit value of a decimal number.

    I was reading the AND in the manner it would be used in Excel. Just to clarify, if I was looking for the interpretation that I put on the function in my second post then the formula would need to look like

    =IIF (({ValueToCheck}>0) AND ({someOtherValue}>0),"on","off" )

    But it is good to know that there is more than one solution (as usual with Microsoft!)

    Hmm, that's not a bitwise operation, in this case you can simply use IIF((X * Z > 0),"on","off")

    😎

    Yeah, I think he was just pointing out that was what he thought my proposed solution earlier in the thread (which does use bitwise AND) was equivalent to. That reading caused a minor confusion before being cleared up 🙂

    Are you sure? The code you posted does say...

    =IIF((ValueToCheck AND (2^(BitToValidate-1)))>0,"On","OFF")

    I don't know SSRS at all. Are you sure that the AND in your solution is a bitwise AND?

    I am indeed quite certain. I'm a paranoid sort, so I pretty much never post anything without testing it first, and this was not one of the exceptions 🙂

    For an extra layer of certainty, https://msdn.microsoft.com/en-us/library/dd255271.aspx can be consulted.

    Cheers!