Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jelindbe
Partner - Contributor III
Partner - Contributor III

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
YoussefBelloum
Champion
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))

View solution in original post

1 Reply
YoussefBelloum
Champion
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))