Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
Leo6
Contributor III
Contributor III

Previous year, month, Quarter Comparison

Hello,

I have date and sales column in my dataset. I wanted to show yearly, quarterly and monthly sales.
and the catch is if I select a filter for year then the visual show me sales for particular year and i want a another visual which shows me the previous year sales, 
similarly, for the quarter if i select 2005 Q1 then another visual will show 2004 Q4 and for the month if I select feb 2005 then the another visual will show previous month which is jan 2005.

at the end i need previous year/quarter/moth values of the selected filters.

Kindly help me with the same

Labels (4)
4 Replies
rubenmarin

Hi, if it's in a table you can add columns for current year, quarter and month, and previous year, quarter and month. And add show conditions to each column.

For KPIs or other objects without the show conditions for dimensions you can add all conditions and expressions in the same expression, like:

If(GetSelectedCount(MonthField)
  ,ExpressionForCurrentOrPreviousMonth
  ,If(GetSelectedCount(QuarterField)  
    ,ExpressionForCurrentOrPreviousQuarter
    ,If(GetSelectedCount(YearField)  
      ,ExpressionForCurrentOrPreviousYear
)))
vinieme12
Champion III
Champion III

Refer this article, users can chose and compare any selected period on a single dimension

https://community.qlik.com/t5/Member-Articles/Period-Presets-Compare-Periods-on-the-fly/ta-p/1486371

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Leo6
Contributor III
Contributor III
Author

Dear @rubenmarin,

Thank you for your kind reply,
Ill surely try this and let you know if this works.

Leo6
Contributor III
Contributor III
Author

Dear @rubenmarin 

Could you please provide me expression for the same, as i am totally new to this am having trouble with expressions.

my month field :

ORDERDATE.autoCalendar.Month