How to display a flag which has values 0,1,NULL directly on the worksheet against some ID's .
Flag denotes whether that specific ID has that product enabled or not or feature unavailable ( NULL) .
I tried using it in Tableau Desktop and getting very weird values .
When I ran through SQL on query editor , I get distinct values 0 , 1 , NULL for that flag .
However I took the same flag in Tableau against those ID's and getting all integers starting 0 to 700.
I used ATTR function and also converting it as Dimension from Measure , also tried using it as continuous / Discrete , values are still not showing as expected.
Any help is appreciated ! Thanks .
@Shubham Vishwakarma It would help if you provided more information about how you are using the field, preferably in a packaged workbook (twbx).
If you create an IF/THEN calculation with integers, Tableau will default to SUM when you put it in the view. Using the Superstore's segment, I created a calculation that is probably similar to yours in structure:
IF [Segment]= 'Consumer' THEN 1
ELSEIF [Segment]= 'Corporate' THEN 0
END
If defaults to SUM, which causes 'Consumer' to show the number of records with that value. If I change another aggregation (in this case MIN, but AVG & MAX would return the same) or ATTR, Tableau will return the value that assigned to 'Consumer'.
However, if you put dimensions other than the one used in the calculation, results will start to vary. SUM will still show how many records are enabled (or 'Consumer' in my example), but MIN will show 0 if there are any disabled/Corporate, MAX will show 1 if any are enabled/Consumer, AVG will show the proportion enabled/Consumer (not including NULLs). ATTR will show * if more than one value is present.
James Emery
Tableau Forum Ambassador
Once a response addresses your problem, please click 'Select as Best' so future users can quickly find the answer.