Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using a variable in a graph title

Hi,

I am getting up and running on Qlik Sense. So far I'm really impressed.

I'm seeing an issue with being able to use functions/variables in a graph title. In QlikView, I was able to set a graph title to:

='Week of ' & makeweekdate(GetFieldSelections(Year),GetFieldSelections(Week)) & 'Hours By Employee'

image106.jpg

In Qlik Sense, not only can I not use this expression, but I can't even seem to use my "Week" variable in something simple like:

'Week: ' & Week

I can only display the week number if the only thing I have in my title is:

Week

At that point it will successfully show the week number that is selected in the "Week" filter object.

Thoughts?

Thanks,

Zak

7 Replies
Gysbert_Wassenaar

Are you sure the exact same expression does really work in the Qlikview document without first selecting a week?

It shouldn't.


'Week: ' & Week is really 'Week: ' & only(Week). And only(Week) can only return a value if only one value of Week is possible. That's why you first need to select a value. You could try 'Week: ' & max(Week) if you want the latest possible week regardless of if you first selected a week or not.

GetFieldSelections(Week) likewise needs selections in the Week field to return a value. But if you select more than one value then it will return the selected values as a comma separated list. But then the makeweekdate function won't return a value anymore, since it needs an integer for the week parameter, not a list of values.


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

Hi,

There is no variables in frontend, but Instead of using a variable you can directly use expression like below

Qliksense Title.png

Regards,

Jagan.

Not applicable
Author

Hi Gysbert, Jagan,

Thanks for your responses. I'm getting slightly different behavior now, but I'm still unable to get it to work the way it did in QlikView. In particular, the expression "makeweekdate(GetFieldSelections(Year),GetFieldSelections(Week))" does not seem to work. Here is a sequence of screenshots to show you that "Week" and "Year" have been selected appropriately, but that makeweekdate() does not work. Have either of you seen makeweekdate() work in Qlik Sense?

image109.jpg

image111.jpg

image112.jpg

image113.jpg

Josh_Good
Employee
Employee

Hi Zak,

I think you may need to upgrade to the latest release of Qlik Sense Desktop.  I'm using version 1.0.1 and it is working for me. I've attached the QVF for your reference.  You can download the latest version here.

-Josh

Qlik

Equation: ='Week of ' & MakeWeekDate(GetfieldSelections(OrderYear),GetFieldSelections(OrderWeek))2014-11-11 10_52_18-Qlik Sense Desktop.jpg

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

='Week of ' & Makeweekdate(Only(Year),Only(Week))

If the above expression not working then update to the latest version of Qliksense as Josh suggested.

Regards,

Jagan.

Not applicable
Author

Hi all,

Thanks for the responses.

I suspected that Qlik Sense wasn't liking my use of "Week" and "Year", since those seem to be keywords.

I changed those variables to "EntryWeek" and "EntryYear", reloaded the data, and rebuilt the filters and the modified the expression appropriately. No luck.

I took a look at Josh's "Test App", which indeed worked appropriately. Thanks for that example, Josh.

For kicks, I changed my variable names to "OrderWeek" and "OrderYear", like in Josh's example. I went through the same cleanup sequence as before, and this time it worked. Strange.

I went back to "EntryWeek" and "EntryYear"- again, no luck.

I went back to "OrderWeek" and "OrderYear"- again, it worked.

I went back to "EntryWeek" and "EntryYear"- this time, it worked.

I suspect there is something flaky going on with the "Title" box. I have noticed a few weird things where changes sometimes don't seem to take effect. When it gets in that state, I clear the field entirely, start from scratch, and then get what I'm looking for.

Anyway, I'm still a bit confused, but at least things are working. I'll spend a bit more time on it to see if I can figure out where things went wrong. If I find anything interesting, I'll follow up with a post.

Thanks again for the responses.

-Zak

jagan
Luminary Alumni
Luminary Alumni

Please close this thread.

Regards,

Jagan.