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: 
Anonymous
Not applicable

Help with an expression

HI everyone.

I have a file with different dates (day/month/year) of 2011, 2012, 2013, and so on. and in the same file i have sales volumen. i want to build a chart that shows only data of on specific fix year despite of the year value the user chooses. Can some one be so kind to help me?

Thanks in advance.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

I think Sunny is right that your field is a date field, and this is your format: day/month/year ?

It would be good to create a calendar from your date field, using QlikSense date and time functions in your script, like

...

Year([Fecha Contable]) AS Year,

Month([Fecha Contable]) as Month,

...

Then what I suggested above should just work fine, if you clear selections on the fields the user selects in:

=Sum({<Year = {2013}, [Fecha Contable], Month >} Sales)

View solution in original post

14 Replies
swuehl
MVP
MVP

Try something like

=Sum({<Year = {2013}>} Sales)

sunny_talwar

I think looking at this document will be very informative to learn about set analysis

Anonymous
Not applicable
Author

I have tried this one, but when i choose a different year it changes and i want to show always the same year

Thansk for your help

Anonymous
Not applicable
Author

I will take a look indeed, thanks for your input

sunny_talwar

If you have what Stefan gave, the expression will never change based on a selection in Year field. It will always show 2013 numbers.

swuehl
MVP
MVP

QV is case sensitive with regard to field names, so if I used {<Year = {2013}>}, your field name must exactely be Year.

If this is the case, and if you then only change selection in Year field, and not in any other field, the returned Sales value changes?

Anonymous
Not applicable
Author

Thanks swuehl

The name of my "dates" field is [Fecha Contable] and i have put the following expression according to what you gave me. In this case Euros is the sales volumen field name.

Sum({<[Fecha Contable] = {2014}>} Euros), and changes when i choose in my App another year

i am doing something wrong?

Thanks again

martinpohl
Partner - Master
Partner - Master

if you choose a year in Qlik Sense, the values are only calculated for the selected year -> automatically.

With set analysis you can for example calculate the sales from the previous year than the selected.

But by itself, Qlik Sense always caculates only the selected datas (year, region, artikle, customer)

Regards

sunny_talwar

If [Fecha Contable] is a date field, then this won't work. The format on LHS and RHS need to match.

You can try this:

Sum({<[Fecha Contable] = {"=Year([Fecha Contable]) = 2014"}>} Euros)

or this may be:

Sum({<[Fecha Contable] = {"=Year({1}[Fecha Contable]) = 2014"}>} Euros)

Sum({<[Fecha Contable] = {"=Year(Only({1}[Fecha Contable])) = 2014"}>} Euros)