Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

macaulay
Contributor

Expression (Year(Today)) is ignored

Dear all,

coming off from this discussion I have a problem with the following expression:

(Sum({$<Year={"(=Year(Today()))"}>}Kosten)+Sum({$<Year={"(=Year(Today()))"}>}Materialeinkauf))

/(Sum({$<Year={"(=Year(Today()))"}>}[Erlös])+Sum({$<Year={"(=Year(Today()))"}>}Schlussrechnung))


As far my knowledge goes, the "$" shall make shure, that just the period of the current year is considered. But it shows the value of the whole data. Furthermore I can change the expression (Year(Today)) to anything else, but nothing happens with the value. Any idea what I did wrong with my formula?


Thanks in previous for the help.

1 Solution

Accepted Solutions
omarbensalem
Esteemed Contributor

Re: Expression (Year(Today)) is ignored

and do u have a field called Year?? make sure it's Year not year; cause qlik in case sensitive !

I see that your Year is blue (which is the color of a function, if qlik was interpreting ur Year as a field, it should be kind of orange !

Capture.PNG

14 Replies
omarbensalem
Esteemed Contributor

Re: Expression (Year(Today)) is ignored

try as follow:

(Sum({$<Year={"$(=Year(Today()))"}>}Kosten)+Sum({$<Year={"$(=Year(Today()))"}>}Materialeinkauf))

/(Sum({$<Year={"$(=Year(Today()))"}>}[Erlös])+Sum({$<Year={"$(=Year(Today()))"}>}Schlussrechnung))



Year(Today()) is a function so it needs an "=" sign:

=Year(Today())

when we have a '=' we add the $ (before each calculation) : $(=Year(Today()) ) => this is 2018

martinpohl
Valued Contributor II

Re: Expression (Year(Today)) is ignored

Hallo Tom,

ändere die Formel in

(Sum({$<Year={$(=Year(Today()))}>}Kosten)+Sum({$<Year={$(=Year(Today()))}>}Materialeinkauf))

/(Sum({$<Year={$(=Year(Today()))}>}[Erlös])+Sum({$<Year={$(=Year(Today()))}>}Schlussrechnung))


Gruss

Martin

macaulay
Contributor

Re: Expression (Year(Today)) is ignored

Thanks for the answers, unfortunately the described behaviour is shown furthermore. I myself can't really explain why the term is ignored, do I have to define "Year" or "Today" in any furhter way?

KPI.JPG

omarbensalem
Esteemed Contributor

Re: Expression (Year(Today)) is ignored

why have u deleted the double quotes?

try with the double quotes as u were doing

pradosh_thakur
Valued Contributor III

Re: Expression (Year(Today)) is ignored

Year field is a text or number/date? there is only explanation i can see for this to not work

omarbensalem
Esteemed Contributor

Re: Expression (Year(Today)) is ignored

and do u have a field called Year?? make sure it's Year not year; cause qlik in case sensitive !

I see that your Year is blue (which is the color of a function, if qlik was interpreting ur Year as a field, it should be kind of orange !

Capture.PNG

pradosh_thakur
Valued Contributor III

Re: Expression (Year(Today)) is ignored

i have provided him the solution in Express KPI of Year (Today)  . Omar Please check the thread once.

macaulay
Contributor

Re: Expression (Year(Today)) is ignored

I tried it the way you mentioned as the way Martin Pohl showd, both ways lead to the same mistake as described.

martinpohl
Valued Contributor II

Re: Expression (Year(Today)) is ignored

to check that the result in set Analysis is ok do:

put your expression into a table.

use any dimension that the table Chart is show values.

don't label the expression!!

Export values to Excel.

There you can see that expression Year=year(today()) is changed into Year = 2017