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', [...
Greg_Deckler
Community Champion
2 years agoYeah, there was an original logic error in XBITOR that I fixed on XBITOR and XBITAND but hadn't gotten around to XBITXOR yet. It's a really simple fix that involves the following two lines of code (both GENERATESERIES). I updated everything.
GENERATESERIES(0, __RowCount * __Length - 1)
and
GENERATESERIES(0, __Length - 1),
AlexisOlson
Super User
2 years agoNice.
I just realized that I posted my XBITOR in the XBITXOR thread.
For XBITXOR, you do need to use the sum logic like you have instead of a simple MAXX for XBITOR and MINX for XBITAND:
XBITXOR =
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",
VAR _Sum = SUMX ( _Padded_, INT ( MID ( [@Padded], [Value], 1 ) ) )
VAR _Result = IF ( _Sum = 1, "1", "0" )
RETURN
_Result
)
VAR _ToString = CONCATENATEX ( _BITOR_, [@Bit], "", [Value] )
RETURN
_ToString