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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
tuan_nguyen
Contributor II
Contributor II

Sum with multiple conditions and formula inside

Hi everyone,

I am a beginner in QlikSense and I am trying to put an expression for sum mile.  I get an error with the following formula :
=Sum(if(Match([type],'1','5','8','200') and [log_mileages.created_at.autoCalendar1.Date] = {">=$(=Date($(vFromDate)))<=$(=Date($(vToDate)))"}, [log_mileages.mile]))

I guess the error is in this part :  and [log_mileages.created_at.autoCalendar1.Date] = {">=$(=Date($(vFromDate)))<=$(=Date($(vToDate)))"}

Can someone please help ?

Thanks !

tuan_nguyen_0-1657098841268.png

Labels (1)
1 Solution

Accepted Solutions
Or
MVP
MVP

Looks like someone mixed in some set analysis syntax that doesn't belong...

 

and [log_mileages.created_at.autoCalendar1.Date] >=$(=Date($(vFromDate)))

and [log_mileages.created_at.autoCalendar1.Date] <=$(=Date($(vToDate)))

Or you could move this part as a set analysis rather than putting it in the if() - note that the parenthesis might be mislocated here since I just cut-pasted the sections around:

Sum( {< [log_mileages.created_at.autoCalendar1.Date] = {">=$(=Date($(vFromDate)))<=$(=Date($(vToDate)))"} >} if(Match([type],'1','5','8','200'),[log_mileages.mile]))

 

View solution in original post

2 Replies
Or
MVP
MVP

Looks like someone mixed in some set analysis syntax that doesn't belong...

 

and [log_mileages.created_at.autoCalendar1.Date] >=$(=Date($(vFromDate)))

and [log_mileages.created_at.autoCalendar1.Date] <=$(=Date($(vToDate)))

Or you could move this part as a set analysis rather than putting it in the if() - note that the parenthesis might be mislocated here since I just cut-pasted the sections around:

Sum( {< [log_mileages.created_at.autoCalendar1.Date] = {">=$(=Date($(vFromDate)))<=$(=Date($(vToDate)))"} >} if(Match([type],'1','5','8','200'),[log_mileages.mile]))

 

tuan_nguyen
Contributor II
Contributor II
Author

Thanks a lot, this helps ! Unfortunately I still have an issue...  how  i can check $(vFromDate) and $(vToDate) because they can be null (i get value from filter panel)

tuan_nguyen_1-1657099663750.png