Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Something obvious with my 'Set' formula I'm just not seeing?

Dear All,

I've having trouble trying to get a Set condition working with a variable for about 5 hours already.

Wondering if someone can shed some light on what's wrong with the following

//sum({$<Year = {2013}>}[Value]) ** This works

//sum({$<Year = { $(=Max(Year)) } >} [Value])  ** This works

//sum (if (Year = $(thisYear), Value)) ** This works

//sum({$<Year = {$(=thisYear) } >} [Value])  //** This not so much !

//sum({$<Year = {$(thisYear) } >} [Value])  //** Nor this

I'm trying to just Sum the [Value] field for the current year.

The thisYear field is defined as follows

SET thisYear = Year(Now());

If I display thisYear in a text field it displays properly

I'm assuming the Set command is reading the literal "thisYear" rather than the value contained in "thisYear".

From my surfing around it looks right but it's obviously not or it would be working

Thanks for any assistance you can provide.

1 Solution

Accepted Solutions
Not applicable
Author

sum({$<Year = {"$(=$(thisYear))"}>} Value)

View solution in original post

16 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

sum({$<Year = {$(=thisYear)}>} [Value]) This will work please check you have done anything else.

MayilVahanan

HI

Try like this

sum({$<Year = {"$(=thisYear)"}>} [Value])

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

This was my first example above //** This not so much !

Not applicable
Author

Just tried this

sum({$<Year = {"$(=thisYear)"} >} [Value])  //** Afraid not

Still not working.

MayilVahanan

Hi

Check thisYear getting today year or not??

Then use like above method.

Hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Not applicable
Author

Doing things the 'old' way

sum (if (Year = $(thisYear), Value)) ** This works

thisYear does have the correct value.'

calvindk
Creator III
Creator III

you can do it like this

sum({$<Year = { $(=Year(Now)) } >} [Value])

but what you were trying to do looks like a double dollar sign expansion, and you werent including the inner expansion.

Not applicable
Author

Unfortunately still the same result ('No data to display')

sum({$<Year = {$(=Year(Now)) }>} [Value])

Not applicable
Author

I had another attempt

Thinking maybe field name 'Value' was a reserved word, I changed it to QuantityField, same result.

This is the code I have in the Text Field which correctly returns 2013

= $(thisYear)

This code works in the 'old' way

sum (if (Year = $(thisYear), QuantityField)) //** This works

Looking for the 'Set' version of the same.

Could it be a 'Type' issue where the Year is string but the evaluation is numeric, or vice versa?