Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Simple if is killing me

Hi,

Im quite new to QlikView but experienced in Excel. I am trying to make a simple If statement but it is killing me!

I have created different expressions that are displayed in a linechart but i am trying to make an if expresseion that will filter out some of them.

When i write:

if(B3>0,B3,B2)

B3 is more then 0 so it should now only display a new line that is excatcly like B3. If B3 would be 0 or less it should make a new line that is exactly like B2.

It doesnt, it instead adds B3+B2 in my new line.

At the same time, if B3 is less then 0 then it only displays B2

Why does it do B3+B2??? when the condition is true in if(B3>0,B3,B2) when the condition is false it does as it should, only shows B2.

(I am also using QlikView 10)

Thanks!

12 Replies
Not applicable
Author

Tor

I'm starting to some of what your problem is, you have full accumulation switched on for these columns which is making life pretty difficult in understanding your data.  So, now that I've siwtched this off, I think we might be able to get somewhere with it, but I'm still not absolutely clear on your requirements.

If you are executing an IF statement per cell then this will run against each YM value, so in your source data you have something like this:

YM          A1     A2     A3

20081     -          929     -

20082     847     -          -

20083     -          472     -

20084     834     767     -

20085     -          -          108

The last line is made up, because you don't have anything with data in A3, however, given the above simple dataset, is the following what you want?

YM          LatestA

20081     929

20082     847

20083     472

20084     767

20085     108

Or is it something else, maybe the above is correct in terms of individual lines but you want each line to be the cumulative total, or maybe I've got it completely wrong again?

Not applicable
Author

Hi Nigel Thanks for your answer.

IN the case you present Lateset A would be simply 108.

If A3 would have been empty it should only be the data in A2. in other words, Latest a would be:

YM          A1     A2     A3

20081     -          929     -

20082     847     -          -

20083     -          472     -

20084     834     767     -

20085     -          -         -

YM              Latest A

20081        929    

20082         -      

20083        472    

20084       767    

20085        -        

So the latset is allways the highest number in A1/2 or 3 but it also has to contain data.

I think this should be a simple if but it allways adds the budgets that contains data for me when i really just want to select and copy one budget, the budgets that contain data and then out of those the one with the highest "name-number"

I hope this clarifies, Thanks a lot for your time and interest and I would be very greatful if you could help me!

Cheers

Tor Lindström

Not applicable
Author

Hi Tor

If this is the case then the solution that I sent on 10th Jan at 11:07 is the one you want to use as this does exactly what you are asking for. Obviously there are things that you are struggling to replicate in your real document but those are what we need to concentrate on, because overall the solution does work as it should (I think).

One of the key things you need to do in your table is to remove the full acumulation on expressions because this is not helping you, it clouds everything.

If you could go back to that solution and take the implementation step by step, we'll try to correct each little problem as it comes up.

Nigel.