Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to show bar chart last 3 months sales based on month maxdate

Hello Experts,

     I have data with month wise sales and  i want to show last 3 months sales based on max date of  each month in bar chart.

When i select April,it will show  April,March,February & If select March,it will show March,February. I am attached  a source file.

Please give a solution to this task.

Thanks in advanced,

Suman.

6 Replies
andrey_krylov
Specialist
Specialist

Maybe with expression

Sum({< Date = {"$(='>=' & MonthStart(AddMonths(Max(Date), -3)) & '<=' & MonthEnd(Max(Date)) )"} >}Sales)

sergio0592
Specialist III
Specialist III

Hi, you can just write :

Sum({< Date = {"$(='>=' & MonthStart(Max(Date), -3) & '<=' & MonthEnd(Max(Date)) )"} >}Sales)

Anonymous
Not applicable
Author

Hello Andrey,

    Your expression is correct But it will shows wrong percentage in my task.

andrey_krylov
Specialist
Specialist

Can you provide more details? What is the expression you are using?

Anonymous
Not applicable
Author

Hai Andrey,

Iam using below  expression

= round(Count({$<Month=, Year=, Date = {"$(='>=' & MonthStart(AddMonths(Max(Date), -3)) & '<=' & MonthEnd(Max(Date)) )"},[Difference Category]={'7Days'}>} DISTINCT Sales)/

Count(DISTINCT {$<Month=, Year=, Date = {"$(='>=' & MonthStart(AddMonths(Max(Date), -3)) & '<=' & MonthEnd(Max(Date)) )"}Sales) *100,0.01,0)

andrey_krylov
Specialist
Specialist

Strangely enough, but I do not see anything that could give the wrong result. Can you share a sample?