Loading

Converting an Integer to Binary.

Дата публикации: Mar 31, 2025
Задача
How to convert an integer to binary in Tableau Desktop.
Действия
Create a calculated field. The following calculation was used to convert SUM([Quantity]) to a binary value and can be reviewed in the attached packaged workbook:
str(int((SUM([Quantity])/2^11))%2)+

str(int((SUM([Quantity])/2^10))%2)+

str(int((SUM([Quantity])/2^9))%2)+

str(int((SUM([Quantity])/2^8))%2)+

str(int((SUM([Quantity])/2^7))%2)+

str(int((SUM([Quantity])/2^6))%2)+

str(int((SUM([Quantity])/2^5))%2)+

str(int((SUM([Quantity])/2^4))%2)+

str(int((SUM([Quantity])/2^3))%2)+

str(int((SUM([Quantity])/2^2))%2)+

str(int((SUM([Quantity])/2^1))%2)+

str(int((SUM([Quantity])/2^0))%2)

The above equation will convert an integer up to 2^11 (2048). For up to ~1 million, the above would have to be modified to include lines at the top for 2^20 down to 2^12.
Номер статьи базы знаний

001456706

Вложения

Quantity to Binary.twbx

1195 KB

 
Загрузка
Salesforce Help | Article