Forum Discussion
powerbi hexadecimal
- 5 years ago
Hi Anonymous ,
In Binary, a equals to 01100001, right?
If so, try this:
Column = VAR Letter_ = DATATABLE ( "Letters", STRING, "Binary_", STRING, { { "a", "01100001" }, { "b", "01100010" }, { "c", "01100011" } } ) VAR Number_text = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" } VAR t1 = ADDCOLUMNS ( GENERATESERIES ( 1, LEN ( [String] ) ), "characters", RIGHT ( LEFT ( [String], [Value] ), 1 ) ) VAR t2 = ADDCOLUMNS ( t1, "convert_", IF ( [characters] IN Number_text, MOD ( TRUNC ( VALUE ( [characters] ) / 8 ), 2 ) & MOD ( TRUNC ( VALUE ( [characters] ) / 4 ), 2 ) & MOD ( TRUNC ( VALUE ( [characters] ) / 2 ), 2 ) & MOD ( VALUE ( [characters] ), 2 ), MAXX ( FILTER ( Letter_, [Letters] = [characters] ), [Binary_] ) ) ) RETURN CONCATENATEX ( t2, [convert_] )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi Anonymous
Do you want a decimal number e.g. 64 or do you want the binary representation of FFFFFFFFFFFFFFFF ?
I don't understand if you want an answer for each column containing binary i.e. 3 separate answers for the table shown above, or just fo a particular column? What do you mean by calculate total number of enabled bits for each row?
Regards
Phil
- Anonymous5 years agoNot applicable
I want to calculate how many binary set bits are enabled(ON or OFF) for first and last columns. for example if i take first column value 0x603...... for this value i want to know how many set bits are enabled in whole number between 0 to 64.
- Anonymous5 years agoNot applicable
Sorry i want to convert each string into binary. like 6307a should give me 01100011000001111100. just conver each char to binary. iam tring to use substitute but it is not working.
- Icey5 years ago
Community Support
Hi Anonymous ,
In Binary, a equals to 01100001, right?
If so, try this:
Column = VAR Letter_ = DATATABLE ( "Letters", STRING, "Binary_", STRING, { { "a", "01100001" }, { "b", "01100010" }, { "c", "01100011" } } ) VAR Number_text = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" } VAR t1 = ADDCOLUMNS ( GENERATESERIES ( 1, LEN ( [String] ) ), "characters", RIGHT ( LEFT ( [String], [Value] ), 1 ) ) VAR t2 = ADDCOLUMNS ( t1, "convert_", IF ( [characters] IN Number_text, MOD ( TRUNC ( VALUE ( [characters] ) / 8 ), 2 ) & MOD ( TRUNC ( VALUE ( [characters] ) / 4 ), 2 ) & MOD ( TRUNC ( VALUE ( [characters] ) / 2 ), 2 ) & MOD ( VALUE ( [characters] ), 2 ), MAXX ( FILTER ( Letter_, [Letters] = [characters] ), [Binary_] ) ) ) RETURN CONCATENATEX ( t2, [convert_] )Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.