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

Date Calculation

I have this existing expression 

round(Avg({<[Item Type]={'Inventory Item','Inventory Cebu'}>}Aggr(Date([Order Date1],'DD/MM/YYYY') - date([Approved Date],'DD/MM/YYYY'),

[Purchase Order No.],ShipID)))

I want to add that if Date([Order Date1],'DD/MM/YYYY') - date([Approved Date],'DD/MM/YYYY') is negative it would use Order Date 2.

And also if Date([Order Date1],'DD/MM/YYYY') - date([Approved Date],'DD/MM/YYYY') is negative and also Order date 2 is null it will not add up to the round(avg).

Labels (2)
1 Reply
marcus_sommer

If you want to add such conditions you will need some simple but probably nested if-loops, like:

... if(DateZ = null(), null(), if(DateX - DateY < 0, DateZ - DateY, DateX - DateY)) ...