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
Anonymous
Not applicable
Author

Hi,

adding to Sunny T advices, you can use an expression like this one:

=Sum({<Ano = {"$(=Year(Today()))"}>} quantity)

where quantity is your metric name.

sunny_talwar

What is the expressions for both of them. You just need to add the set analysis to your existing expressions. We can help you here if you share your expressions here.

Not applicable
Author

Here are the expressions:

1) Sum(Occupants)

2) [Percentage Occupants]

sunny_talwar

See if one of these work:

1)

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

or

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

2)

=Only({<Ano= {"$(=Max(Ano))"}>}[Percentage Occupants])

or

=Only({<Ano= {"$(=If(GetFieldSelections(Ano) = 0, Year(Today()), Max(Ano)))"}>}[Percentage Occupants])