Skip to main content
Announcements
Save $600 on Qlik Connect registration! Sign up by Dec. 6 to get an extra $100 off with code CYBERSAVE: REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
scotly-victor
Creator II
Creator II

Current Month, Previous Month ,Current Month Previous Year

Hi All,

I have requirement that I want to show line chart that should be Current Month, Previous Month ,Current Month Previous Year wise sales

dimension: day

current month:

sum({<type={'Order'},FiscalMonth={$(=month(max(FiscalMonth)))}>} Sales)

it works fine

ex -  FiscalMonth :apr


and i have encountered error in previous month

previous month:

sum({<type={'Order'},FiscalMonth={$(=month(max(FiscalMonth)-1))}>} Sales)

Can anybody help ?



7 Replies
Anonymous
Not applicable

Hello Scotly

Please try using addmonths function as below:

addmonth(max(FiscalMonth),-1)



Regards

Chintan

sunny_talwar

May be use this:

Previous Month

Sum({<type={'Order'}, Date = {"$(='<=' & Date(MonthStart(Max(Date), -1), 'YourDateFieldFormatHere') & '>=' & Date(MonthEnd(Max(Date), -1), 'YourDateFieldFormatHere'))"}>} Sales)

PreviousYear

Sum({<type={'Order'}, Date = {"$(='<=' & Date(AddYears(Max(Date), -1), 'YourDateFieldFormatHere') & '>=' & Date(AddYears(Max(Date), -1), 'YourDateFieldFormatHere'))"}>} Sales)

If this doesn't work, would you be able to provide a sample to look at?

Anil_Babu_Samineni

Sunny,


I hope all is well with QlikView..

I have one Excel, In that.. In that i have fields like -- Date, Sales, Product..

So, once i apply to Bar graph. I want to achieve in bar chart show current month, previous month, last year current month.

Ex:- Let's Say, if i select May - 2016 on dimension i want in bar chart like -- May - 2016 and April - 2016 and May - 2015

Note: Please find O/P like attached Image for Reference..!

738cd762-3a83-476d-b861-3ba592c46b0a.jpg

Thanks,

Anil.

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable

Hello Scotly

Are you able to resolve your issue? You may post the expression you used, it will be useful for others facing similar issue.

Thanks & Regards

Chintan

scotly-victor
Creator II
Creator II
Author

Hi Chinatan,

Issue got resolved.

Thank you

stephenedberkg
Creator III
Creator III

try this


sum({<type={'Order'},FiscalMonth={$(=month(max(FiscalMonth)-1))},month=,year=>} Sales)

Anil_Babu_Samineni

Can you please post that. If possible, Please stick the Correct answer whoever gave the right way on your wall tab. Current Month -- Expression ? Last Month -- Expression ? Last Year Current Month -- Expression ?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful