7 Replies Latest reply on Jun 16, 2016 9:26 PM by Ashish Chaudhari

# Tableau Last year net calculation with OR condition

Hi All,

I was wondering about teh OR condition in Tableau.

Example:  Please see below Excel sheet

I need to calculate Last Year Net based on current sales. So when the current week sales are 0 or blank I dont need Last Year Net.

Calculated field:

IF [New Week Status] = 'Current Full Week' AND (NOT(ISNULL(Net))) OR (Net > 0)

THEN [LastYear_Net]  end

The above works for the 1st excel file, but whn I use this formula for the below file, it shows me all the total and doesnt filter 0's.

Could anybody help me on this?

Kind Regards,

Shivang Desai

• ###### 1. Re: Tableau Last year net calculation with OR condition

Hi Shivang can you populate dummy number in the structure and share the same?

• ###### 2. Re: Tableau Last year net calculation with OR condition

please check the attached sheet in tableau and use the formula mentioned above. Thanks!

• ###### 3. Re: Tableau Last year net calculation with OR condition

Sorry to jump into this.

Try this

Mahfooj

• ###### 4. Re: Tableau Last year net calculation with OR condition

Hi Shivang,

I hope this will give you the result. Try the below code,

IF [New Week Status]="Current Full Week" and ([Net]<>0 or [Net]<>NULL) THEN [LastYear Net] END

I hope this helps.

Thanks and Regards,

Ashish Chaudhari

• ###### 5. Re: Tableau Last year net calculation with OR condition

• ###### 6. Re: Tableau Last year net calculation with OR condition

Hi All,

Thanks for the help! So basically I was looking for an extension for this.

I have attached an excel file and also a screenshot below:

here there are different store names, I am looking for Last Year Net whose new week status is current full week and sales > 0 for same store. Example: As we see above, store A has a vlaue of 0 but it also has sales in current full week. So I need to include the Last Year Net that is 662 also.  Similar for store C.

Also another imporant thing is store E and store F shouldn't be included.

Thanks

• ###### 7. Re: Tableau Last year net calculation with OR condition

Hi Shivang,

is it possible to share the sample data? I would also like to know if you have upgraded from 8.3 to the latest version 9.3.

Populate dummy number if it is confidential.

-Ashish