Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
coxanagi
Contributor II
Contributor II

show monthly for the selected year, only for the months in which there were sales in the previous year

Show monthly for the selected year, only for the months in which there were sales in the previous year.

For example, if there were sales in November and December in 2013, then if selected 2014 should only show sales for November and December, even if there were sales in every month of the year.

I've tried this


sum({$ <year={$(=Max(year))}, Months=P({1 <PeriodID={ "<= $(=(Max(PeriodID)-12))>=$(=(Max(PeriodID)-23)) "} > } Months)> } sales)


where PeriodID is a number created to simplify the transition between dates.


LOAD   Months,

           year,

           (year -1)* 12 + Months as PeriodID;



In this case (December 2013) = 24156


Also tried something like this:


sum({$ <year={$(=Max(year))}, Months={"=sum({ <PeriodID={'=($(=Max(PeriodID)-12))'}>} sales)>0" }>} sales)


hopefully someone can help me.



1 Reply
MK_QSL
MVP
MVP

Sorry but unable to understand your question... Can you please provide sample file?