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

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Doubts about expression/days

Hi everybody: I have a little question, i dont know what function or what to do in this case.

I have to calculate a quantity. I have a lapse of time this is a difference between when something is ordered and delivered. This is final date - initial date. For example 1 day or 5 days or 20. In the graphic i have to divide the quantity in the numbers of the diference . I dont know how to do this with the number of days.

1 - 15, 15-30, etc

Sory for my poor english, i´ll put the needed graphic.

In the dimension i´ve put =DAY(DATE((FechaFin - Fecha), 'YY/MM/DD')) . I see the dates, but i´d like to group them.

Labels (1)
15 Replies
JonnyPoole
Former Employee
Former Employee

I think some IF statements to make sure its 0-60 or over 60 would help:


IF (  [Final Date] - [Start Date]  >= 0 and  [Final Date] - [Start Date] <= 60, 


     PurgeChar( Class( [Final Date] - [Start Date]  , 15,'to'),'>=<') ,


      IF( [Final Date] - [Start Date] > 60,  '60+')

)

Not applicable
Author

Thank you.

You helped me a lot.

Cheers!

JonnyPoole
Former Employee
Former Employee

I thought i saw a question about sorting.

On the sort tab, sort by the calculated dimension and select 'expression'. In the expression try type

min([Final Date] - [Start Date])

MarcoWedel
MVP
MVP

Hi,

another solution could be:

QlikCommunity_Thread_139461_Pic2.JPG.jpg

=If(FechaFin-Fecha<60,Dual(Replace(Class(FechaFin-Fecha,15),'<= x <','to'),Class(FechaFin-Fecha,15)),Dual('60+',60))

QlikCommunity_Thread_139461_Pic3.JPG.jpg

QlikCommunity_Thread_139461_Pic1.JPG.jpg

This way you don't have to care about special sorting expressions:

QlikCommunity_Thread_139461_Pic4.JPG.jpg

hope this helps also

regards

Marco

Not applicable
Author

That´s very helpful too.

Thank you, Marco.

Greetings.

MarcoWedel
MVP
MVP

You're welcome

regards

Marco