Hi There,
I am trying to create a calculated field where I am using FIXED level of detail. I am using 'Country' field for fixed level of detail, and using the same 'Country' field in Filters. I am summing up Sales measure of last year (hence using [Year Selection]-1) using this. Below is the calculated field code:
ATTR({FIXED [Country]: SUM(IF YEAR([Order Date]) = INT([Year Selection])-1 THEN [Sales] END)})
'Year Selection' is a parameter that just has Years of dates.
It works fine as long as only 1 Country is selected, but if I select more than 1, then it returns NULL.
Please note that I've created this field just for reproducing the issue, my actual code is being used in a waterfall chart where I am trying to calculate Gantt Chart Start position using this.
Attached the Worksheet where I have reproduced this issue. Any help will be greatly appreciated!
Rishabh
Just looking at it, it does that because of ATTR.
ATTR({FIXED [Country]: SUM(IF YEAR([Order Date]) = INT([Year Selection])-1 THEN [Sales] END)})
Try to remove it. Your calc. should look like this:
{FIXED [Country]: SUM(IF YEAR([Order Date]) = INT([Year Selection])-1 THEN [Sales] END)}
Attribute(ATTR) computes like:
IIF(MIN([dimension]=MAX([dimension]),MIN([dimension]),'*')
It does not actually return NULL but *.
Become a Viz Whiz on the Forums! Support the Community and master Tableau.