6 Replies Latest reply on May 18, 2016 6:49 PM by Manideep Bhattacharyya

Null Handling in Date Field

Hello - I have the following data set

I am writing a simple identifier of Week and for Sequence 2, I expect the calculated expression will return 02-Jan-2015

But Tableau returns the Desired date along with a "Null" row, that is causing big trouble. I want to understand why Null is appearing for this.

Thanks,
Manideep

• 1. Re: Null Handling in Date Field

This is down to your IF formula. What you've actually written is

IF [Sequence] = 2 THEN [Week Date] ELSE NULL END

Although you haven't explicitly specified that every sequence that isn't 2 is NULL, that's how tableau interprets it - and why you're finding the NULL value returned.

You could always filter on this field and exclude the NULL value.

• 2. Re: Null Handling in Date Field

Andrew Watson - Thanks for your prompt response. I am trying to understand that why Tableau is going into "ELSE" part of it where it gets satisfied by the if statement. I can filter, but want to understand the behavior of Tableau in detail.

Pooja Gandhi

Thanks,

Manideep

• 3. Re: Null Handling in Date Field

Manideep - One saying which I coined long ago is "It's all about the rows".  If you look at what your logic returns at a row level it will be clearer what is happening.   You can do this by adding the sequence identifier dimension on the rows shelf and that will show you what is happening at the row level of your data and why it is being aggregated as such.

• 4. Re: Null Handling in Date Field

Hi Manideep,

That Null is for the other dates, since you have just mentioned the condition for sequence equal 2.

What about the other dates. If the conditions are failing for other sequences (which are not 2) then they will be classified as Null (which you are getting).

Output for the sequence = 2 (you can observe that other values associated with dates other than sequence = 2 are getting aggregated in Null)

Actual week wise data (Null = 181+166+132+167).

I hope this will help. I would like to know your thoughts on this and what is expected output as per you.

Thanks and Regards,

Ashish Chaudhari

1 of 1 people found this helpful
• 5. Re: Null Handling in Date Field

Attaching the workbook for the same.

• 6. Re: Null Handling in Date Field

Dear @Ashish - At the first place, I want to understand why Tableau is getting into else loop.

Thanks,

Manideep