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: 
ArjunPrasad
Contributor III
Contributor III

How to achieve in Script

Hi Community,

I am new to QlikSense.

i have a data like below , from this i would like to arrange these Items in a Order at the top Expiry coming earliest.

Assume the data tody is 22/08/2020.

Can any one help/ suggest me how can i achieve in script.

Capture.JPG

Thanks,

Arjun

Labels (1)
1 Solution

Accepted Solutions
uroboros
Creator
Creator

Hi @ArjunPrasad, you only need sum the two fields

Something like this:
Date(ManufacturingDate + ExpiryDays) as expirydate

If you need add months, the function it's addmonths()

https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFun...

 

this should resolve your question.

View solution in original post

6 Replies
Taoufiq_Zarra

can you share the expected output from these data ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
ArjunPrasad
Contributor III
Contributor III
Author

Hi Taoufiq,

my expected output is like below.

Assume today date is "22.08.2020"

Capture.JPG

Thanks

Arjun

Kushal_Chawda

@ArjunPrasad  You can do something like below

Data:
load Item,
     ManufacturingDate,
     if(floor(ManufacturingDate)< floor(today()),1,0) as _Flag
     ExpiryDays
FROM table;

Now in your frond end chart you can put the expression using Flag
Assuming your measure is Sum(ExpiryDays) so expression will look like below

=Sum({<_Flag={1}>}ExpiryDays)
ArjunPrasad
Contributor III
Contributor III
Author

Hi Kush,

in Sql i have used below query to get expected Output(refer below screenshot)

Select *,DATEADD(D,ExpiryDays,ManufacturingDate) as expirydate

from Table1
order by DATEADD(D,ExpiryDays,ManufacturingDate)

 

Capture.JPG

Thanks

Arjun

uroboros
Creator
Creator

Hi @ArjunPrasad, you only need sum the two fields

Something like this:
Date(ManufacturingDate + ExpiryDays) as expirydate

If you need add months, the function it's addmonths()

https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/DateAndTimeFun...

 

this should resolve your question.

ArjunPrasad
Contributor III
Contributor III
Author

Thank you @uroboros 🙂

Now i am got expected result in Qlik.