Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
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