8 Replies Latest reply on Dec 4, 2017 7:49 AM by Renu Arjun

# ZN

Hi,

I have been reading through prior posts trying to better understand how to apply the ZN function. I would prefer to use this instead of the other options (ISNULL or IFNULL) if possible. I am able to apply the ZN function ZN([Measure]).

However, when I used it in a longer calculation, it does not seem to work. I have copied my formula below. I have not attached the workbook because I am still trying to figure out how to do so without sharing sensitive information.

IF (([Version]=14 or [Version]=5) AND [Clasification]='INCOME')

AND [Record_Date]=[Choose Month]

THEN ZN([Budget])/[UF-Budgeted Rate]*-1

ELSEIF (([Version]=14 or [Version]=5) AND [Clasification]='EXPENSES')

AND [Record_Date]=[Choose Month]

THEN ZN([Budget])/[UF-Budgeted Rate]*-1

END

Thanks,

Renu

• ###### 1. Re: ZN

Good morning

you say that ZN doesn't work - what does your formula return? and what did you expect to get

The best approach is to attach a workbook - see the link Anonymize your Tableau Package Data for Sharing

Jim

• ###### 2. Re: ZN

Thanks. I am working on anonymizing my data but it is taking a while.

I am trying to get the Null value to return zero. I have calculations where I am trying to show the difference between Actual and Budget and there are no values for the cells that are considered null.

I will attach a workbook shortly.

Thanks,

Renu

• ###### 3. Re: ZN

Hi Renu Arjun,

IF (([Version]=14 or [Version]=5) AND [Clasification]='INCOME')

AND [Record_Date]=[Choose Month]

THEN ZN([Budget])/[UF-Budgeted Rate]*-1

ELSEIF (([Version]=14 or [Version]=5) AND [Clasification]='EXPENSES')

AND [Record_Date]=[Choose Month]

THEN ZN([Budget])/[UF-Budgeted Rate]*-1

END

Could you create a calculated field ie. zn(Budget) and then replace that in your field.

Hope this works.

-AV.

• ###### 4. Re: ZN

Hi,

I tried that but it did not work.

Thank  you.

Renu

• ###### 5. Re: ZN

I am not able to get to a workbook I can share. None of my calculations are copying over to the new source. I have watched the video several times. I will have to see what else I can figure out.

• ###### 6. Re: ZN

In this If statement - you have if and else if but you do not have else. This if statement will return null for a row that does not meet both if and elseif section.

did you look into this already?

• ###### 7. Re: ZN

Thank you.

I added an Else 0 at the end and it has solved the issue.

Much appreciated insight!!!!!