Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

nurulatikah
New Contributor

How to write set analysis for display current year

Hi,

I am using Qlik Sense and want to use set analysis to display Current Year and Previous year. I already try a few expression but not working to me. Can anyone help me ?

I have field name Order Date and sales in this case

Here is a few expression that I try :

SUM({$<Year={$(=MAX(Year))}>}Sales)

SUM(${<Year={"$(=Year(Today()))"}>}Sales)

Thank You

Nurul

2 Replies
MVP
MVP

Re: How to write set analysis for display current year

How are you creating Year field in the script? Like this

Year(OrderDate) as Year? If it is like this... then this looks right to me

SUM({$<Year={$(=MAX(Year))}>}Sales)

or

SUM({$<Year={$(=Year(Today()))}>}Sales)

isaiasdd
Contributor

Re: How to write set analysis for display current year

You can use:

Year(today()) // show the current year

Year(today())-1 // show the previous year based on current year

In yours expressions:

SUM({$<Year={'$(=Year(Today()))'}>} Sales)   // sales for current Year

SUM({$<Year={'$(=Year(Today())-1)'}>} Sales) // sales for previous Year

Community Browser