Loading

Converting an Integer to Binary.

Fecha de publicación: Mar 31, 2025
Tarea
How to convert an integer to binary in Tableau Desktop.
Pasos
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.
Número del artículo de conocimiento

001456706

Archivos adjuntos

Quantity to Binary.twbx

1195 KB

 
Cargando
Salesforce Help | Article