Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Samanehsorournejad

How to only show last 6 Months in the Chart

Hi Every one,

I have a Linear Chart and I want in my X Axis show only the data for Last 6 Months.

I had use this Formula:


aggr(
If(
Date(MonthStart([%Datum])) >= Date(MonthStart(AddMonths(Max([%Datum]), -5))) and Date(MonthStart([%Datum])) <= Date(MonthStart(Max([%Datum]))),
[%Datum]
),
[%Datum]
)

but it does not work. Can any one help me pleaseeeee?

Thanks in advanced

 

Labels (2)
1 Solution

Accepted Solutions
Aasir
Creator III
Creator III

Your expression is almost there just try to fit below. I’m using Today()

aggr(
If(
Date(MonthStart([%Datum])) >= Date(MonthStart(AddMonths(Today(), -5)))
and Date(MonthStart([%Datum])) <= Date(MonthStart(Today())),
[%Datum]
),
[%Datum]
)

View solution in original post

3 Replies
Anil_Babu_Samineni

If you have already measure since you are designing in chart, I will recommend to restrict in expression to avoid bad performance. Example,

{<[%Datum]={>=AddMonths(Max([%Datum]), -5)<=Max([%Datum])}>}

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
Samanehsorournejad
Author

thanks a lot for your answer it was that you write is not Dimension its measure I think! and when I write in my Dimension its show me the error unfortunately 😞

Aasir
Creator III
Creator III

Your expression is almost there just try to fit below. I’m using Today()

aggr(
If(
Date(MonthStart([%Datum])) >= Date(MonthStart(AddMonths(Today(), -5)))
and Date(MonthStart([%Datum])) <= Date(MonthStart(Today())),
[%Datum]
),
[%Datum]
)