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

this set analysis is getting to complex for me!!

i have 2 columns one with a counter depending on a >= value(>=10)

this value is also in a column with set analysis

now i like to combine these 2 in 1, so i can remove the other column

column 1

count(

{$<GAUGE_VALUE_CALC={">=10"},ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'},

GAUGE_VALUE_CALC

)

column 2





max({$<ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'},

ZUIS_EIND_TIME_DATE={">=$(=DATE(YEARSTART(MAX(TIME_DATE)),'DD-MM-YYYY hh:mm:ss')) <=$(=DATE(MONTHSTART(MAX(TIME_DATE)+ADDMONTHS(MONTH(MAX(TIME_DATE)),1)),'DD-MM-YYYY hh:mm:ss'))"}>}ZUIS_BUDGET_VALUE1)

this set analysis is getting to complex for me!!







1 Solution

Accepted Solutions
Not applicable
Author

Yes, those dollar sign expansions are evaluated once for the whole table. Many times, they are based on selections, which are universal to every record in the table.

You may have to do the:

if(GUAGE_VALUE_CAL >= ???, Count({<...>} GUAGE_VALUE_CAL)


I still don't know how that would work. It's quote complicated. Could you load in the GUAGE_VAL_CAL_THRESHOLD as a record in your table? Then you could do:

if(GUAGE_VALUE_CAL >= GUAGE_VAL_CAL_THRESHOLD, Count({<...>} GUAGE_VALUE_CAL)


View solution in original post

13 Replies
Not applicable
Author

Are you trying to combine those into one big Set Analysis expression? One issue I see is that your Set Analysis is not finished at the end of the first expression.

One thing that can be helpful when working with huge expressions is to use variable substitutions. Set up variable1:

GAUGE_VALUE_CALC={">=10"},ZUIS_BWMETHODE_CODE={'NVT'},
ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},
SELECTION_CODE={'MISPI01'}


And another:

ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},
OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'},
ZUIS_EIND_TIME_DATE={">=$(=DATE(YEARSTART(MAX(TIME_DATE)),'DD-MM-YYYY hh:mm:ss'))
<=$(=DATE(MONTHSTART(MAX(TIME_DATE)+
ADDMONTHS(MONTH(MAX(TIME_DATE)),1)),'DD-MM-YYYY hh:mm:ss'))"}


Then you can combine them in a simpler expression:

max({$<$(vVar1),$(vVar2)>} ZUIS_BUDGET_VALUE1)


You have some repeated modifiers in the two equations, so you could get rid of those.

Not applicable
Author

i would like the value 10 from {"<=10"} being replaced with the the second set analysis

i will try to use some variables so the set looks less complicated

Not applicable
Author

BTW how do you paste your code in this forum, I like this kind of text box too

Not applicable
Author

The code is done using [ code ] and [ /code ] without the spaces. When you're posting, there is a light blue box that has a hyperlink to a post about adding code.

I see what you're saying about replacing the >10 portion. I think you can do it, but it's long:

count({$<GAUGE_VALUE_CALC={">=$(=max({$<ZUIS_BWMETHODE_CODE={'NVT'},
ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},
SELECTION_CODE={'MISPI01'},ZUIS_EIND_TIME_DATE=
{">=$(=DATE(YEARSTART(MAX(TIME_DATE)),'DD-MM-YYYY hh:mm:ss'))
<=$(=DATE(MONTHSTART(MAX(TIME_DATE)+ADDMONTHS(MONTH(MAX(TIME_DATE)),1)),
'DD-MM-YYYY hh:mm:ss'))"}>}ZUIS_BUDGET_VALUE1))"},
ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},
OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'}>}
GAUGE_VALUE_CALC)


You could simplify that as:

count({$<GAUGE_VALUE_CALC={">=$(vMaxExp)"},
ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},
OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'}>}
GAUGE_VALUE_CALC)


If you set up a variable, vMaxExp as:

$(=max({$<ZUIS_BWMETHODE_CODE={'NVT'},
ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},
SELECTION_CODE={'MISPI01'},ZUIS_EIND_TIME_DATE=
{">=$(=DATE(YEARSTART(MAX(TIME_DATE)),'DD-MM-YYYY hh:mm:ss'))
<=$(=DATE(MONTHSTART(MAX(TIME_DATE)+ADDMONTHS(MONTH(MAX(TIME_DATE)),1)),
'DD-MM-YYYY hh:mm:ss'))"}>}ZUIS_BUDGET_VALUE1))


Another tip is to place this expression in Table Chart, but don't give the expression a label. Then when the chart is rendered, the label will be your Set Analysis expression with the dollar sign expansions evaluated. That will let you know if your expressions are coming out correctly.

Not applicable
Author

looks like this working!!

But the auto syntax control (colors) is gone in this statement after position

count({$<GAUGE_VALUE_CALC={">=$(=max({$<ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'},ZUIS_EIND_TIME_DATE={"

but its working thats whats counting



Not applicable
Author

one more question because now if use the above syntax with the 'if' statement

and that does not work again!!

if (count({$<GAUGE_VALUE_CALC={">=$(=max({$<ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'},ZUIS_EIND_TIME_DATE={">=$(=DATE(YEARSTART(MAX(TIME_DATE)),'DD-MM-YYYY hh:mm:ss')) <=$(=DATE(MONTHSTART(MAX(TIME_DATE)+ADDMONTHS(MONTH(MAX(TIME_DATE)),1)),'DD-MM-YYYY hh:mm:ss'))"}>}ZUIS_BUDGET_VALUE1))"},ZUIS_BWMETHODE_CODE={'NVT'},ZUIS_WPMETHODE_CODE={'LAB'},OBSERVATION_METHOD_CODE={'WNS2251'},SELECTION_CODE={'MISPI01'}>}GAUGE_VALUE_CALC)>=1
,
1
,
0
)


Not applicable
Author

It's probably because you have double-quotes inside double-quotes. QlikView thinks that is the end of the section starting with that first double-quote after GUAGE_VALUE_CALC. I don't know if it matters, because QlikView will evaluate the dollar sign correctly. I think only the context coloring is affected. Sometimes you can omit double-quotes if you are already inside double-quotes, but I'm not sure that would work in this case.

I'm not sure why it doesn't work within the if. Is the if expression giving you a null value (-)? I put it into a Text Object and the parentheses line up, so I'm not sure what the problem could be.

Not applicable
Author

no the result is a 1 for every row

i did what you said about the table and no label

i see in the column without the 'if', '>=10', which is correct

in the column with the if is see '>=', so no value, not correct!!

Not applicable
Author

sorry my mistake!!