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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
HelloHMC
Contributor III
Contributor III

Numeric searches

I want to use the method below to limit the range of number in chart expression, but it can‘t limit the range of number successfully. 

HelloHMC_2-1765155880972.png

https://help.qlik.com/en-US/sense/May2024/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/SetAnalysi...

 

This is my test data:

[XXX]:
load 
*
inline [
A,B
1,2
2,3
3,4
4,6
5,6
4,6
3,7
];
 
Then I want to build a line chart, the chart expression is as below:
Dimensions: "A"
Measures: Count({$<A={">=3<= 4)"}>}B) 
 
But the line chart, no matter what is the end value of “A” I have chosen, it will display to 5.
That means the expression didn't refrain the "A" correctly.
 
I want to confirm if I write the chart expression correctly or not.
BTW,  I have written it according to the qlik learning.
Labels (2)
11 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi @HelloHMC 

There you go!

1. when you did date() on Today()-30 bracket was in wrong place so you still would get number result. please note that making Max() and other numerical operations changes mas from date back to number!

2. when you did <= you missed date() functions

3. The above assumptions are based on the fact that i think your DATE_WORK field was formatted as default date based on variables from beginning of the script!

count( {$<DATE_WORK={">=$(=date(max(DATE_WORK)-30))<=$(=date(max(DATE_WORK)))"},WORK_STATE={'Y'}>} [Employee ID]) /
count( {$<DATE_WORK={">=$(=date(max(DATE_WORK)-30))<=$(=date(max(DATE_WORK)))"}>} [Employee ID])

 

do you see the difference?

cheers

Lech

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
HelloHMC
Contributor III
Contributor III
Author

I have find what is the problem, thank you all~

There are some blanks within the chart expression, so the correct one is as below:

count( {$<DATE_WORK={">=$(=date(max(DATE_WORK)-30))<=$(=max(DATE_WORK))"},WORK_STATE={'Y'}>} [Employee ID])/
count( {$<DATE_WORK={">=$(=date(max(DATE_WORK)-30))<=$(=max(DATE_WORK))"}>} [Employee ID])

The wrong one is as below:

count({$<DATE_WORK={">=$(=date(max(DATE_WORK)-30)) <= $(=max(DATE_WORK))"}, WORK_STATE={'Y'}>}[Employee ID]) /
count({$<DATE_WORK={">=$(=date(max(DATE_WORK)-30)) <= $(=max(DATE_WORK))"}>}[Employee ID])

If you are interested in the detail, you can compare two chart expression to find what is the exact problem~

BR!