Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
alwayslearning
Creator
Creator

IF and set analysis and time

Hi,

I have a IF statement, which has an expression which sums and converts various time fields.

=num(if((Sum(Log_In_duration)/60)=0,' ' ( (SUM(Time)+SUM(Time2)+ ((sum(Time3)/3600)+sum(Time4)))/60)

/Sum([Log_In_duration]/60)), '##0 %')

In addition to the above formula which works as is, I need the formula to only return date specific data.

I have created a variable titled vcurrentweek from a field "DATE" and was looking to do a SET Analysis for current week and perform the above.  However I am getting various errors and hoped someone could help.

Thanks

1 Solution

Accepted Solutions
Anil_Babu_Samineni

May be this?

=num(if((Sum(Log_In_duration)/60)=0,' ' ( (SUM({<DATE = {$(vcurrentweek)}>} Time)+SUM({<DATE = {$(vcurrentweek)}>} Time2)+ ((sum({<DATE = {$(vcurrentweek)}>} Time3)/3600)+sum({<DATE = {$(vcurrentweek)}>} Time4)))/60)

/Sum({<DATE = {$(vcurrentweek)}>} [Log_In_duration]/60)), '##0 %')

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

5 Replies
Anil_Babu_Samineni

May be this?

=num(if((Sum(Log_In_duration)/60)=0,' ' ( (SUM({<DATE = {$(vcurrentweek)}>} Time)+SUM({<DATE = {$(vcurrentweek)}>} Time2)+ ((sum({<DATE = {$(vcurrentweek)}>} Time3)/3600)+sum({<DATE = {$(vcurrentweek)}>} Time4)))/60)

/Sum({<DATE = {$(vcurrentweek)}>} [Log_In_duration]/60)), '##0 %')

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
devarasu07
Master II
Master II

Hi,

Another simplified way u can try like below using set analysis

Num(sum( {$<Log_In_duration={"=Sum(Log_In_duration)/60)=0"},Year={"$(=Max(Year))"},Week={$(vcurrentweek)}>} (Time2+(Time3/3600)+(Time4/60))/ (Log_In_duration/60) ),'#,##0%')

alwayslearning
Creator
Creator
Author

Thanks Anil,

This works perfectly.

*Note:If anyone uses the code above in the future, there is a , missing before the false statement begins.

alwayslearning
Creator
Creator
Author

Thanks Devarasu

Anil_Babu_Samineni

I am correcting myself

=num(if((Sum(Log_In_duration)/60)=0,' ', ( (SUM({<DATE = {$(vcurrentweek)}>} Time)+SUM({<DATE = {$(vcurrentweek)}>} Time2)+ ((sum({<DATE = {$(vcurrentweek)}>} Time3)/3600)+sum({<DATE = {$(vcurrentweek)}>} Time4)))/60)

/Sum({<DATE = {$(vcurrentweek)}>} [Log_In_duration]/60)), '##0 %')

Please add me Anil_Babu_Samineni to interact faster when reply back. Speak low think High.

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)