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: 
Not applicable

Equating the date fields based on current selections

Hi,

I  have a requirement wherein I am supposed to display the count of tasks that got submitted and complete in the time frame as per the current selections i.e., in case i have selected the Common year as 2013,I would want to display the tasks that got submitted and also completed in 2013 .Suppose if i select month as jan then the tasks that got submitted and completed during jan irrespective of the year must get displayed.I did try to acheive the same using the below expression

  count({<Flag={1},
CompletedYear={$(=GetFieldSelections(CommonYear))
},

CompletedMonth={

$(=GetFieldSelections(CommonMonth))},

CompletedWeek={

$(=GetFieldSelections(CommonWeek))},

CompletedDay={

$(=GetFieldSelections(CommonDay))}
>}

TaskId)

But the issue is that incase i do not make selection on any of the above fields like if i do not select day.The expresion does not give me the desired result.So please help me optimize the above expression


1 Solution

Accepted Solutions
Nicole-Smith

Michael Solomovich's answer should work, but I think the use of P() should also work and it's a bit shorter:

=count({<Flag={1},

CompletedYear=P(CommonYear),

CompletedMonth=P(CommonMonth),

CompletedWeek=P(CommonWeek),

CompletedDay=P(CommonDay)

>}

TaskId)

View solution in original post

8 Replies
Anonymous
Not applicable
Author

If you don't make selections, the function GetFieldSelections() returns null.  If you want this to work without selections, try using concat():

=count({<Flag={1},

CompletedYear={$(=concat(CommonYear,','))},

CompletedMonth={$(=concat(CommonMonth,','))},

CompletedWeek={$(=concat(CommonWeek,','))},

CompletedDay={$(=concat(CommonDay,','))}

>}

TaskId)

Regards,

Michael

Nicole-Smith

Michael Solomovich's answer should work, but I think the use of P() should also work and it's a bit shorter:

=count({<Flag={1},

CompletedYear=P(CommonYear),

CompletedMonth=P(CommonMonth),

CompletedWeek=P(CommonWeek),

CompletedDay=P(CommonDay)

>}

TaskId)

Not applicable
Author


Thanks Michael the solution that you have provided is giving me the desired results.Can you please explain the use of concat function here and the logic behind I dont seem to understand the logic used,it would be very helpful if you would guide me on the same

Not applicable
Author

Hi Nicloe,

The approach you have suggested is working well.I am unable to figure what is P() and the logic behind the code.So could you please explain the same

brindlogcool
Creator III
Creator III

If you are looking for P( ) definition. P( ) refers to set of possible values. You can refer the set Analysis section for more details

Not applicable
Author

Hi Anushree,

CompletedYear={$(=concat(CommonYear,','))}

here concat function concatenates the values selected on frontend for CommonYear with ',' and returns it to the CompletedYear

If you select 2012 and 2013 then it returns - 2012,2013

CompletedYear=P(CommonYear)

P() function returns all the possible CompletedYear values of selected CommonYear value

Hope you understood.

Regards,

Nuthan

Nicole-Smith

Anushree,

I think Brindlogcool and nuthan kumar did a good job explaining P(), so you should be able to figure it out from there.

Also, please mark helpful and correct answers in order to help others find solutions to their problems as well

Not applicable
Author

Thanks Nuthan for a very good explaination