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

Error in calculated dimension (Don't know why)

Hi everybody. I was working with this dimension, and it was working.

=IF(EndDate-Date <60, PurgeChar(Class(EndDate - Date ,15,'a'),'>=<') , '+ 60')

Now, i have to replace the "EndDate" With this

timestamp(If([(QUANTITY1- QUANTITY2] = 0, Aggr(MAX(AutoDate), CodigoWeb), '-')) (this expresion works in the expression part)

And when i replace this in the calculate dimension it doesn´t works! I doesnt make sense, the sintax is OK

i'll put an example in the QV!

Please help me i´ve been trying to fix it for a long time

Greetings

18 Replies
Not applicable
Author

Ok, when the [(QUANTITY1- QUANTITY2] != 0 i wanna have the "-" This is because the items aren´t delivered yet and there isn´t a finish date. And then i´d put "dont select nulls" (because the client don't wanna see the items that aren´t delivered yet)


Thank you!




jerem1234
Specialist II
Specialist II

Okay, so that should not be summed in that case. Got it. So use my second expression.

Just to clarify, when you type in '-', that does not make the value null, it makes it a string equal to a dash. If you want to truly have it null(), either user null(), or do not add the second parameter to the if statement: if([(QUANTITY1- QUANTITY2], max(Date))

If you don't add a third parameter to the if statement, it automatically sets whats not true to a null value.

Not applicable
Author

Ok man, thank you!

I see now that i dont have the "-" in the second expression.

I have one question but if you prefeer i can´t put it in another thread.

Now i´m groupping by the num_web( is the "primary key" of the table). Should i aggregate by the dates too? because i dont know if the expression is taking the dates when i have 4 or 5 dates in the same num_web

Sory but this expression is a bit too dificult to mee.

Cheers.

jerem1234
Specialist II
Specialist II

Can you post an example of what your data looks like? Just using the fields CodigoWeb, EndDate, and StartDate

In this format:

CodigoWeb, EndDate, StartDate

1, 10/02/2014, 14/02/2014

1, 13/02/2014, 17/02/2014

...

Is that what it looks like? If not, please post an example.

Not applicable
Author

Of course! For example:

CodigoWebFechaFecha_Fin
-
2306/02/2014-
2426/02/2014-
2526/02/2014-
3428/02/201413/05/2014
3328/02/201413/05/2014
2728/02/201413/05/2014
2628/02/201413/05/2014
2828/02/201413/08/2014
2931/03/2014-
3014/04/201427/05/2014
3114/04/2014-
3514/04/2014-
1624/04/201409/05/2014
1724/04/201415/05/2014
1824/04/201409/05/2014
1924/04/201415/05/2014
2024/04/201427/05/2014
2124/04/201429/05/2014
jerem1234
Specialist II
Specialist II

Hmm i don't see any multiple dates for the web. Can you elaborate more on what u mean with "because i dont know if the expression is taking the dates when i have 4 or 5 dates in the same num_web"

Can you show an example of that in your data?

jerem1234
Specialist II
Specialist II

Just to be save, I'd also put min around your Date field as well. If you say there are multiple dates for a CodigoWeb, then you'd probably want the longest stretch between any there. So:

=aggr( if(sum(CantidadAdjuntada) - sum(CantidadEntregada) = 0, if(MAX(AutoDate)-MIN(Date)<60,PurgeChar(Class(MAX(AutoDate)-MIN(Date),15,'a'),'>=<'), 'Mas de 60')), CodigoWeb)

So this will assign a class to the length of time from the min Date to the max AutoDate for each CodigoWeb. If that is what you are looking for

Hope this helps!

Not applicable
Author

Sory i´ve just seen this. I´m proving it now. In this case is the same with or without the MIN.

Thank you. You helped me a lot, Please help me the next time! haha.

Not applicable
Author

If you can, help me with this please

Doubts about an If statements and replacing values.