Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Select year and month

Could anyone help me, I'm trying to do an action to select the current year and the very last month that contains data from the corresponding year.

I thank you.

3 Replies
Not applicable
Author

Hi,

You can use below Expressions :

Set Analysis :

sum( {$< Year_Cost = {$(#=Year(today())-1),$(#=Year(today()))} , Month_Cost = {$(=Month(AddMonths(Today(),-1)))} >} Value)

General Condition:

=Sum(
if(Month(Date) = Month(today())-1
and
(Year(Date) = Year(today()) or Year(Date) = Year(today())-1),
Value))

Both the expressions provide result for previous month and Current , Previous Year

Not applicable
Author

Thanks for the quick response, but you do not understand, for the year really need to get the current, but for months, as the base is not updated constantly, I need to catch the last months that have data. For example, the current month is July where we are, but based on last month is May.

Not applicable
Author

Create a button with two "Select in Field" actions in it for Year and Month fields from your Calendar table.

For Year field use this:

=year(today())


For Month field use this:

=month(addmonths(yearstart(today()) , (max({1 <Year={"$(=year(today()))"}>} Month) - 1)))


Take a look at an example from attachment