Skip to main content

Hello,

 

Ok so I am going to ask something really basic here, so please don't kill me on this one.

 

The other day I was working on a viz and was trying to fill in a hierarchy where the values are null.  So I tried to do this by using an IF..THEN statement.

 

There are times that when a lower level is null I will use IIF(ISNULL([Level 2]), [Level 1], [Level 2]) - Works great!

 

In my current situation I tried to fill in the null Level 2 value by using a condition based upon the value of the Cost Center Code.

 

So what I tried was this: IF [Cost Center Code] = 'Z6100' AND ISNULL([Level 2]) THEN 'Director' END

 

I ended up with an error and could never get the dang thing to work.  I ended up exporting this to Excel and using a spreadsheet for my hierarchy information.  Anyone else got any good ideas?  Anyone can explain why this error?

 

Thank you,

Scott

 

Level 1Level 2Cost Center Code

 

Org AOrg BZ6200Org ANullZ6100

Michael Hesser

6 respuestas
  1. 7 mar 2019, 23:08

    Hi, Scott

     

    To fix the error in your if-else calculation, please see my solution below

    Hi, Scott To fix the error in your if-else calculation, please see my solution below the reason is, for each of the field, it has a data type, string, int, float or Boolean, etc.

     

    the reason is, for each of the field, it has a data type, string, int, float or Boolean, etc. as the integrity of data, each field can be only one type, it can't be multiple.

    So, in your original expression, [Node Lvl 5]='AJVC' is a Boolean type because it returns either true or false, while [Node Lvl 4] is a string, that breaks the data integrity.

     

    and back to your question, what's your expectation of the value should be in your worksheet for lvl5 of NMZ6100 ?

    pastedImage_1.png

     

    ZZ

0/9000