Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

using buit in functions in set analysis

Hi

I want to compare the week  and year of end field(which has dates in it) with todays week and year within set analysis based on which i need to perform count of emp_id,and thus used the expression

 

=count({$<year(End)={(=(year(today()))},week(End)={(=week(today()))}>}Emp_Id)

But,this is not giving me desired results.Can any one help me with the same

6 Replies
MayilVahanan

HI

Try like this

In script , bring Year and Week field name for END..

Then Try like this

=count({$<Year={$(=year(today()))},Week={$(=week(today()))}>}Emp_Id)

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

I would want to implement this on front end and not in scripting

swuehl
MVP
MVP

Try something like

=count( {$<End={">=$(=Date(weekstart(today())))<=$(=Date(weekend(today())))"} >} Emp_Id)

Add appropriate format codes for Date() function if needed.

jduenyas
Specialist
Specialist

Hi,

Looking at your answer and seeing the use of Double Quotes in the expression prompts me to ask you directly the same question I just posted under the title SET ANALYSIS. Many thanks if you can answer:

In an example of set analysis which I have downloaded, an expression was written as such:

=if(sum({$<YR = {$(=max(YR - 1))}, MO = {"<=$(=max({<YR={$(=max(YR))}>} MO))"}>}  TranAmt)
>
sum({$<YR = {$(=max(YR))}, MO = {"<=$(=max({<YR={$(=max(YR))}>} MO))"}>}  TranAmt),
sum({$<YR = {$(=max(YR))}, MO = {"<=$(=max({<YR={$(=max(YR))}>} MO))"}>}  TranAmt),
sum({$<YR = {$(=max(YR) - 1)}, MO = {"<=$(=max({<YR={$(=max(YR))}>} MO))"}>}  TranAmt)
)

Although it is a bit convoluted I can descern that  Month = {"<=$(=max({<Year={$(=max(Year))}>} Month))"}>}  is to find the Month which is "less than or equal Max Month of the Max Year".

My question though is regarding the double quote: When / where / why use double quotes vs single quotes if use any of them at all? And is there any written material regarding advanced construct and punctuation of expressions within set analysis?

Thanks

rbecher
MVP
MVP

Hi,

use double qoutes for a search expression (like you can use in listbox search or search object) and single qoutes for a literal string value or $-expansion.

- Ralf

Astrato.io Head of R&D
jduenyas
Specialist
Specialist

Thanks Ralf