Greg_Deckler
Community Champion
2 years agoXBITXOR
It's BITXOR but for multiple rows.
XBITXOR =
VAR __RowCount = COUNTROWS('bitor')
VAR __Length = LEN(MAX('bitor'[day_of_month_bit_position]))
VAR __String = CONCATENATEX('bitor', [...
AlexisOlson
Super User
2 years agoIf the bit strings are not all the same length, then you probably want to left pad with zeros like this:
XBITOR =
VAR _BitStrings_ =
SELECTCOLUMNS (
DISTINCT ( 'bitor'[Pos] ),
"@BitStr", 'bitor'[Pos]
)
VAR _Length = MAXX ( ALLSELECTED ( 'bitor' ), LEN ( 'bitor'[Pos] ) )
VAR _Padded_ =
ADDCOLUMNS (
_BitStrings_,
"@Padded", REPT ( "0", _Length - LEN ( [@BitStr] ) ) & [@BitStr]
)
VAR _BITOR_ =
ADDCOLUMNS (
GENERATESERIES ( 1, _Length ),
"@Bit", MAXX ( _Padded_, MID ( [@Padded], [Value], 1 ) )
)
VAR _ToString = CONCATENATEX ( _BITOR_, [@Bit], "", [Value] )
RETURN
_ToStringGreg_Deckler
Community Champion
2 years agoAlexisOlson I like the idea of padding for instances of having different lengths of bits.