Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to show data from the current year using set analyses?

Hello everyone,

I am trying to create a bar chart where i would like to display data from the current year by category, but it should be dynamic, user can view other years by clicking in the filter:

year.JPG

I am just using the field name in my expression, and using the field "Category" as a dimension.

I can´t use triggers, once it will set the rule for all objects in my sheet.

So, how can i create the rule to display the current year in my chart?

Thanks


13 Replies
sunny_talwar

Add this to your expression's set analysis:

{<Year = {"$(=Max(Year))"}>}

sunny_talwar

or this:

{<Year = {"$(=If(GetFieldSelections(Year) = 0, Year(Today()), Max(Year)))"}>}

Not applicable
Author

Hi Sunny,

The name of the field for Year is "Ano".

Should i use the name of the field in the expression you suggested, or should i use "Year" exactly how you wrote?

Thanks

sunny_talwar

So something like this:


{<Ano= {"$(=Max(Ano))"}>}

or

{<Ano= {"$(=If(GetFieldSelections(Ano) = 0, Year(Today()), Max(Ano)))"}>}

silambarasan
Creator II
Creator II

{Year={$(=max(Year))}>}

Mark_Little
Luminary
Luminary

Hi,

Or you can try something like {Ano={$(vYear)}}

Create a variable vYear -

Year(Today())

Mark

Not applicable
Author

Thanks for your quick answer!

Should i have 2 expressions in my chart?

One for the dimension and another for the set analyses?

Capturar.JPG

sunny_talwar

No you just need one expression. What is your current expression?

Not applicable
Author

I have two situations:

1) A chart that displays the sum of the field "Occupants" by category

2) A chart that displays the percentage of "Occupants" by category.

Both charts should display data from the current Year.