4 Replies Latest reply on Oct 26, 2017 6:14 AM by Michael Byars

# Calculated field that appends multiple calculated field results

I have created 9 calculated fields (D-0, D-15, ...) that return the desired results.  Now I want to create a single dimension (or  measure if more appropriate) that combines the fields into one by appending the data, not creating a combined string field.  I know I can do this in Excel very easily, but I am at a loss in how to replicate it in Tableau.

Version 10.3.0

• ###### 1. Re: Calculated field that appends multiple calculated field results

Hi Micheal,

What do you mean by appending ... do you mean concatenating the string representation of the field value (Date, Int, etc) ... I notice D-0 is a date field ... if this what you mean you can combine them like that:

str(D-0) + str(D-1) + str(D-2) .... + str(D-n)

if this not what you mean ... please clarify more

Best Regards

• ###### 2. Re: Calculated field that appends multiple calculated field results

No, i already know how to do that. simply put,  if the d-0 data was 10 rows jan1-jan10 and d-15 was 20 rows jan11-jan30, I want to make a new d-n to be 30 rows jan1-jan30. Does that mare since?

• ###### 3. Re: Calculated field that appends multiple calculated field results

in fact it does not ... you have two types of calculated field:

1- row level calculated field where and its a function of column value in the same row, and the result is a new column on that row.

2- aggregated field and its function of aggregation on the current level of detail that appear in the VIZ.

what I mean is that no calculated field will result in another rows added to the data set, if D-0 has 10 distinct value in the overall data set in D-15 has 20 distinct value, this can not be combined in a new rows to be added to your data, the only thing that you can do is to validate a constant date against them in the aggregation level ... for example

[IsDateWithin]

IF (

SUM( if today() = [D - 0] then 1 end)

+

SUM( if today() = [D - 15] then 1 end)

) > 0 then TRUE

else FALSE

end

the above calculated field return true today() is one of D0 and D15 distinct dates, else it return false....

Best Regards

• ###### 4. Re: Calculated field that appends multiple calculated field results

I had a feeling that was the issue.  It would be nice to have that kind of functionality.  Thank you.