Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Month + 1 IF Statement

Hello All,

I am trying to create a dimension for a 'Month+1'. I created a varable Month1 which is:

Date

(NumMonth+1 &'/01/' & Year, 'MMM')

This shows the correct date but when I add it to my dimension I get 0

=sum(distinct
if(([Company] = 'USA'
AND [Company] = BudgetCompany
AND [Year]= BudgetYear
AND BudgetMonth = $(Month1)),Budget))/1000

If I add the actual Month Name it works correctly

=sum(distinct
if(([Company] = 'USA'
AND [Company] = BudgetCompany
AND [Year]= BudgetYear
AND BudgetMonth = 'Mar' ,Budget))/1000





2 Replies
Not applicable
Author

if you want to calculate the current month plus one, ie the next month, you can use the expression

Month (Today ()) +1


= sum (distinct
if (([Company] = 'USA'
AND [Company] = BudgetCompany
AND [Year] = BudgetYear
AND BudgetMonth = Month (Today ()) +1, Budget)) / 1000

I hope you serve.

Miguel_Angel_Baeyens

Hello,

Note that QlikView is case sensitive, you your month name must be spelled the same way it is when you do Month(Date).

To get the next month, I'd rather use something like the following:

=Month(AddMonths(Today(), 1))


Hope this helps.