5 Replies Latest reply on Aug 23, 2017 6:05 AM by Zhouyi Zhang

# If Condition

Hi All,

I have requirment like below

I need if condition logic for the below condition.

In table i am having year and part number column,If part number exist in current year and previous year then boolean value should come 1 , if part number is missing any of the year it should display 0 only

--------------------------------------------------------------------------------------------------------

IF

[Internal OR External]='EXTERNAL' AND [Exclusion Revenue Amount] ='CLEAN REV' and [Product Exclusion Flag]='INCLUDED ITEMS FOR SPI'

then (if 'part number repeated ' then 1 else 0)

ELSE 'Outlier'

END

Thanks,

Lakshmi

• ###### 1. Re: If Condition

Lakshmi

Have you tried below?

IF

[Internal OR External]='EXTERNAL' AND [Exclusion Revenue Amount] ='CLEAN REV' and [Product Exclusion Flag]='INCLUDED ITEMS FOR SPI'

then (IF { FIXED [part number]:COUNTD([year])} = 2 THEN 1 ELSE 0 END)

ELSE 'Outlier'

END

The only thing I'm not sure is what dimension you use in your viz and I assume you only have 2 years data, if you could share a sample workbook will be more helpful.

ZZ

1 of 1 people found this helpful
• ###### 2. Re: If Condition

Hi ZZ,

i have implemeted the the logic wat ever u have given,but am getting the below error

Thanks,

Lakshmi

• ###### 3. Re: If Condition

Hello Lakshmi,

I think problem is with your [Exclusion Revenue Amount] ='CLEAN REV'. By name it's lokking that it should be a measures and value should be in numbers.

TG

• ###### 4. Re: If Condition

Create Calculated field with fixed phrase to determine the part number that exists in the current year, it will be something like that:

{ fixed [Part Number] :

max(if year([Date]) = year(todate()) then 1 else 0 end )} = 1

Make also another field for previous year

{ fixed [Part Number] :

max(if year([Date]) = (year(todate()) - 1) then 1 else 0 end )} = 1

Then you can merge both in one calculated field

{fixed [Part Number] : max(

if [Parts of current year] = true and [Parts Of Prev year] = true

then 1

else 0 end) } = 1

Then you can use this field to make VIZ that display the part number that exists in both ....

<<see the attached image >>

• ###### 5. Re: If Condition

Hi, Lakshmi

change the 'Outlier' to 0 will fix the error

ZZ