# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Our next Qlik Insider session will cover new key capabilities. Join us August 11th REGISTER TODAY
cancel
Showing results for
Search instead for
Did you mean:
Partner

## This year and last year

I have this expression:

if(Week(today())<19,

Sum({<År0101={'\$(=year(today()-1))'},Framskrivningsalternativ={"Faktisk"}>}Folkemengde_fram_SSB),

Sum({<År0101={'\$(=year(today()))'},Framskrivningsalternativ={"Faktisk"}>}Folkemengde_fram_SSB))

The first conditional expression is supposed to retrieve the sum for last  year. The second expression is supposed to retrieve the sum from the current year.

The first expression does not work correctly. Consequently, both expressions give me the same result (from the current year).

1 Solution

Accepted Solutions
Champion

Hi,

try this:

if(Week(today())<19,

Sum({<År0101={'\$(=Year(AddYears(Today(),-1)))'},Framskrivningsalternativ={"Faktisk"}>}Folkemengde_fram_SSB),

Sum({<År0101={'\$(=year(today()))'},Framskrivningsalternativ={"Faktisk"}>}Folkemengde_fram_SSB))

1 Reply
Champion

Hi,

try this:

if(Week(today())<19,

Sum({<År0101={'\$(=Year(AddYears(Today(),-1)))'},Framskrivningsalternativ={"Faktisk"}>}Folkemengde_fram_SSB),

Sum({<År0101={'\$(=year(today()))'},Framskrivningsalternativ={"Faktisk"}>}Folkemengde_fram_SSB))

Tags
Community Browser