Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
KC3
Creator
Creator

How to apply formula for taken only specific Month

Hi QLikians,

 

I need specific months data, can you please help me with the forumla.

I have Date it needs to be change in month. i applied =MonthName(Date) for getting months so i am getting Apr 20202, May2022 like this.

I want data only for Oct 2022, Sep 2022 please help me with the formula.

KC3_0-1669287483973.png

 

 

Labels (5)
2 Replies
brunobertels
Master
Master

Hi 

change the dimensoin monthname(Date) as a calculated dimension 

somethink like this 

if(Monthname(Date)='Sept 2022' and Monthname(date) ='Oct 2022', Monthname(Date) ) 

unselect include null values 

If you want the twice month selected dynamically ( for example the last 2 past month before the current month , apply the same approach using addmonth() and Today() functions 

 

monthname(addmonths(today(),-2)) For septembre ( 2 months before actual month)

monthname(addmonths(today(),-1)) for octobre 

vinieme12
Champion III
Champion III

Option1 You can restrict data using set analysis in your measures

example ins your measures ad below set analysis

=sum({<Date={">=$(=Date(Monthstart(Max(Date),-2)))<=$(=Date(MonthEnd(Max(Date),-1)))"}>} Sales)

OR

Option2 Restrict Dimension values using calculated dimension

example below will restrict data for last 2 months

replace  = MonthName(Date)  with below

 

=aggr(MonthName(Only({<Date={">=$(=Date(Monthstart(Max(Date),-2)))<=$(=Date(MonthEnd(Max(Date),-1)))"}>}Date)),Date)

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