Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

If statement within set analysis

Hi,

I'm struggling to make my set analysis expression to work. I'm trying to get the total time where ordernumber is equals to the choosen ordernumber on my filter pane and requestdescription is not blank. Here's my code:

sum ({1<[OrderNumber]=P({$<[OrderNumber]={"if(len(trim([RequestDescription]))>0,

[OrderNumber])"}>}[OrderNumber])>}

num#((Interval([StpDate]-[StrtDate], 'ss'))/60/60))

Appreciate any inputs or suggestions... Thanks in advance. -sv

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Sum({1<[OrderNumber]=P([OrderNumber]) * {"=Len(Trim(RequestDescription)) > 0"}>} Num#((Interval([StpDate]-[StrtDate], 'ss'))/60/60))

View solution in original post

6 Replies
sunny_talwar

Can you try this:

Sum({1<[OrderNumber]=P([OrderNumber])>} Num#((Interval([StpDate]-[StrtDate], 'ss'))/60/60))

or

Sum({1<[OrderNumber] = $::[OrderNumber])>} Num#((Interval([StpDate]-[StrtDate], 'ss'))/60/60))

Not applicable
Author

Hi Sunny,

Thanks for the quick response. Yes, I tried it and its working but I also need to check on the "RequestDescription" if its not blank then I could add the date and get the sum for it.

Actually here's my previous code that was working just need to add the check for the "RequestDescription"...

sum ({1<[OrderNumber]=P({$}[OrderNumber])>}

num#((Interval([StpDate]-[StrtDate], 'ss'))/60/60))


-sv

sunny_talwar

May be this:

Sum({1<[OrderNumber]=P([OrderNumber]) * {"=Len(Trim(RequestDescription)) > 0"}>} Num#((Interval([StpDate]-[StrtDate], 'ss'))/60/60))

Not applicable
Author

Hi Sunny,

Here's what I did and it worked:

sum ({1<[OrderNumber]=P({$<"if(len(trim([RequestDescription]))>0, [OrderNumber])">})>}

num#((Interval([StpDate]-[StrtDate], 'ss')))/60/60)

I think your code will also work.Really appreciate your help.

Cheers -sv

b_garside
Partner - Specialist
Partner - Specialist

He could also create a Flag in the script for checking for Null or empty values in the SA

sunny_talwar

Great, if you got what you were looking for, I would suggest closing this thread by marking correct and helpful responses.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny