Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Evaluate a string

hi guys,

I'm in trouble with an expression on my designer.

I have to build an expression. This expression depends on what you select on a field Month.

I have to sum a num of fields called TKF001, TKF002 ... TKF012.

If you select Month 01 and 02 i have to build an expression like that:

(TKF001 + TKF002) / 2

So, I tried to use Evaluate() functions but it doesn't work on designer.

I tried to put my string on a variable and then use it:

     $(Var1)

Where Var1 = 'TFK0' & GetFieldSelections(VG.Month,'+TKF0',12)

but unfortunately it doesn't work too.

Any suggestions to help me.

Thanks a lot

Giampiero

I write for you my expression:

if(GetSelectedCount(VG.Mese)=0

,//THEN

    (TKF001 + TKF002 + TKF003+ TKF004+ TKF005+ TKF006+ TKF007+ TKF008+ TKF009+ TKF010+ TKF011+ TKF012)/12

,//ELSE

     Evaluate('TFK0' & GetFieldSelections(VG.Month,'+TKF0',12)) / GetSelectedCount(VG.Month)

)//ENDIF

1 Solution

Accepted Solutions
CELAMBARASAN
Partner - Champion
Partner - Champion

Try something like this

use concat or GetFieldSelections

=$(=Concat(DISTINCT 'Sum(TKF0'&VG.Month,')+')&chr(41))

View solution in original post

7 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Try something like this

use concat or GetFieldSelections

=$(=Concat(DISTINCT 'Sum(TKF0'&VG.Month,')+')&chr(41))

Not applicable
Author

Hi,

Thank you so much.

It works perfectly.

I found a different way to solve my problem that work as well as yours.

($(= ('TKF0' & GetFieldSelections(VG.Mese,'+ TKF0',12)))) / GetSelectedCount(VG.Month)

Again, THANK YOU SO MUCH.

agigliotti
Partner - Champion
Partner - Champion

Hi,

I have the following tables:

tab_0:

LOAD * INLINE [

Prodotto, Formula, Campo1, Campo2, Campo3

Prod1, Campo2*3, 1, 10, 100

Prod2, Campo3-Campo2, 2, 20, 200

Prod3, Campo1+Campo2, 3, 30, 300

];

tab_1:

NoConcatenate

Load *, Evaluate(Formula) as Prezzo Resident tab_0;

drop table tab_0;

but I get the "Prezzo" field values equals to NULL !

I have to obtain a table as below:

Prodotto,   Prezzo

Prod1        30

Prod2        180

Prod3        33

How can I achieve it ?

Please let me know.

Many thanks.

,

Best Regards

swuehl
MVP
MVP

Andrea,

maybe this is helpful, it discusses some different approaches to handle your issue:

http://community.qlik.com/thread/38857

Regards,

Stefan

bruno_m_santos
Partner - Creator
Partner - Creator

Hi,

I liked a lot your post.

Has for some time I was looking for a solution like that.

I have a similar requirement.

= ($ = Concat (DISTINCT 'Sum ($ (vSetMTD)' & Measure, ') +') & chr (41)) works well.

but not this:

= ($ = Concat (DISTINCT 'Rank (Sum ($ (vSetMTD)' & Measure, ') +') & chr (41) & chr (41)

You know what might be wrong.

Thank you for your help.

Bruno

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

Check with this

=$(=Concat (DISTINCT 'Rank (Sum ($ (vSetMTD' & Measure,chr(41) & '+') & chr (41) & chr (41))

bruno_m_santos
Partner - Creator
Partner - Creator

Hi,

Many thanks for your help.

Unfortunately the expression that you suggest doesn't return values.

I found another solution:

= $(=Concat(DISTINCT 'Rank('& 'Sum($(vSetMTD) '& Measure,')+')&')'& chr(44) &'0'& chr(44) &'1' &chr(41))

It's the right way to do it?

Thanks

Bruno