Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

set analysis

Hi,

Is any thing wrong in this expression. Pls help me

Count(text([Campaign Channel])='PPC')[Site Visit Vis Num]

14 Replies
Anonymous
Not applicable
Author

Count({<[Campaign Channel]={'PPC'}>}[Site Visit Vis Num])

Anonymous
Not applicable
Author

I have to use text function in set analysis

vardhancse
Specialist III
Specialist III

What is the value for Campaign Channel field

PrashantSangle

Hi,

Try

Count(if(text([Campaign Channel])='PPC'),[Site Visit Vis Num]))

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
tresesco
MVP
MVP

Two issues:

  • Improper expression (syntax/structure) - the correct way of set analysis expression is -  Count({<[Campaign Channel]={'PPC'}>}[Site Visit Vis Num])
  • Improper Set Expression syntax - Count({<Text([Campaign Channel])={'PPC'}>}[Site Visit Vis Num]) - left hand side of set expression can only be a script generated field , so no function can be used like text().

Instead you can create a field in the script with text() and use that in set expression like:

Load

          Text([Campaign Channel]) as TextChannel

              ....

Then, Count({<TextChannel={'PPC'}>}[Site Visit Vis Num])

Or,

try with simple IF statement.

Anonymous
Not applicable
Author

In Qvx target file data type is unknown, but campaign channel is char.

Anonymous
Not applicable
Author

Can't we use this functions directly in set analysis

tresesco
MVP
MVP

No. Not on the LHS.

ToniKautto
Employee
Employee

A set expression contains set modifiers, which efficiently are equal to selections. The text you define in the set modifier, will apply a selection in the same way as if it was a search string. Naturally a search string like "=Text(MyValue)" will search for the value "=Text(MyValue)" and not the result you would get if the function was evaluated.

You can accomplish a calculation in the set modifier by using dollar expansion, but this require that you consider how the expansion is made.

Set expression and dollar expansion