Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Previous Month

Hello ppl!

I have a question!

Ived created a variable called vPreviousMonth =month(addmonths(max(Date_Clean),-1))

I want a straight table which shows current month i have selected (ive made that) and then i want the previous table to show previous month

e.g. If i am in November i also want to see October - If i am in July, i also want to see June..

How do i make that expression?

My expression for currentmonth looks like this:

=Sum({<Month=, Year=,2012={'>=$(=MonthStart(Max(2012)))<=$(=Max(2012))'}>}BuyPriceRealized)

I dont know if that expression is correct if not i would also like to know how the "right" way is to do it...

Thanks ALOT!!

19 Replies
SunilChauhan
Champion
Champion

no change required in expression

see below code

first expression

Sum({$<Month={"$(vCurrMonth)"}>}Volume)

second expression

Sum({$<Month={"$(vLastMonth)"}>}Volume)

third expression

=Column(1)-Column(2)

hope this helps

Sunil Chauhan
Not applicable
Author

What is monthYear ? Should i make a variable called month year also???

SunilChauhan
Champion
Champion

its a field available in your application.

Sunil Chauhan
Not applicable
Author

Hmmm - i dont see it anywhere???

Not applicable
Author

IS it because i only have Personal edition ATM?

SunilChauhan
Champion
Champion

if you have date field in script then make it as

Month(Date)&'-'&Year(Date) as MonthYear

Hope this helps

Sunil Chauhan
Not applicable
Author

I dont have any scripts - I made my DATE dimension in the data warehouse (ssis) - i have not created a MasterCalendar.... Do i need to do that?

shree909
Partner - Specialist II
Partner - Specialist II

so u have only month dimension? dont you have any dimenion related year, date, something like that...

Not applicable
Author

No i have a DateDimension

My Date dimension includes: Days, Month, Years, Quarter, Weeks and so on....

I have a row called Month_Name which includes january,feburary and so on... I try to use that one but it doesnt work?

Not applicable
Author

i cant it to work - i think its something about my timestamps ? Yours are in // - The strange think is when i make vCurrMonth i can see my months when selecting - but i cant see any sum...

If i make a listbox with the date as dimension and sum on my byprice it works perfectly!

Have i forgotten to change something somewhere???