Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Highlighted
Not applicable

cannot use '>' in set analysis

Hi,

I'm having a problem using '>' in a set analysis.

The expression works fine without '>', but after adding '>', it returns 0.

=sum({1<period={">=1"}>}sales)

What could be the reason?

Thanks,

dodo

Tags (1)
1 Solution

Accepted Solutions
Employee
Employee

Re: cannot use '>' in set analysis

In some occasions, QlikView can consider that numerical values are text. This can happen for instance when the source file is excel, and that the cell type in excel is text, and not numerical.

in this case

the = statement in set analysis works, because QlikView makes a string to string comparison : "1" = "1" returns true

the >= statement does not because we don't have an inequality comparator on strings : "1" >= "1" returns false

have you tried forcing the column type in the script using for instance "Num(period) as period"

you could also force a numerical type in the document properties ("number" tab)

Loic

9 Replies
MVP & Luminary
MVP & Luminary

Re: cannot use '>' in set analysis

Are you sure that you have a numeric period and there are values >= 1? Then generally these syntax worked.

- Marcus

Not applicable

Re: cannot use '>' in set analysis

Yes, 12 periods, all have numbers.  And, the expression works if I make it equals to any period.

MVP & Luminary
MVP & Luminary

Re: cannot use '>' in set analysis

Please post a small example - this worked for me:

= sum({<Monat={">=11"}>} Values)

- Marcus

Not applicable

Re: cannot use '>' in set analysis

In this link you can find a set analysis wizard it will help you to generate the expression in the way that you want:

Set Analysis Wizard for QlikView | qlikblog.at

thisisnita
Contributor

Re: cannot use '>' in set analysis


Hi,

Please use below expression:

=sum({1<period={"<13"}>}sales)

Employee
Employee

Re: cannot use '>' in set analysis

In some occasions, QlikView can consider that numerical values are text. This can happen for instance when the source file is excel, and that the cell type in excel is text, and not numerical.

in this case

the = statement in set analysis works, because QlikView makes a string to string comparison : "1" = "1" returns true

the >= statement does not because we don't have an inequality comparator on strings : "1" >= "1" returns false

have you tried forcing the column type in the script using for instance "Num(period) as period"

you could also force a numerical type in the document properties ("number" tab)

Loic

aveeeeeee7en
Valued Contributor III

Re: cannot use '>' in set analysis

Hi

See this:

restrict data in a table

Regards

Aviral Nag

Partner
Partner

Re: cannot use '>' in set analysis

Hi,

in order to check if your field is reading values as number you can either check it in the table viewer (ctrl + T) and put the mouse over the field in the data model to see the type of data of that field. Another option is creating a listbox/tablebox with this field. By default qlikview aligns numbers to right and text to left,

regards

Not applicable

Re: cannot use '>' in set analysis

Thanks for all the replies!

Loic gave the best explanation.