Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
March 11, 2PM EST: Do More with Qlik - Getting Started wtih Qlik Sense SaaS - Redux. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
berryandcherry6
Creator II
Creator II

Condition to Display only last 4 month.

Hi,

I am trying to display only last 4 months.

so for thaat I have Canonical_Month in script, which contains all 2015 and 2016 months.

LOAD

    Date(CanonicalDate, 'MM-DD-YYYY') AS CanonicalDate,

Month(CanonicalDate) As Canonical_Month;

Now i need only last 4 months irrespective of year.


How could i do this? Any help is appreciated

1 Solution

Accepted Solutions
kaushiknsolanki
MVP & Luminary
MVP & Luminary

Hi,

You can use the Where condition to restrict your data.

After From or Resident statement you should use Where condition like below.

Load *

From XYZ

where CanonicalDate >= addmonths(today(),-4);

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

3 Replies
kaushiknsolanki
MVP & Luminary
MVP & Luminary

Hi,

You can use the Where condition to restrict your data.

After From or Resident statement you should use Where condition like below.

Load *

From XYZ

where CanonicalDate >= addmonths(today(),-4);

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".

View solution in original post

berryandcherry6
Creator II
Creator II

Hi,

Thanks for reply

If i need to apply this condition in front end of  Dimension. How could i restrict data in dimension instead of  in script using where condition.

Could that be done?

kaushiknsolanki
MVP & Luminary
MVP & Luminary

Hi,

In front end you should use the set analysis.

Your expression will become.

Sum({<Date = {">=$(=Addmonths(Max(Date),-4))"}>}Sales)

Regards,

Kaushik Solanki

Regards,
Kaushik
If reply is satisfactory, please "Like" the post.
If reply is solution, please mark as "Correct".