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

Bar chart to show records for previous month

Hi, this is my first week with QS and I am struggling with displaying chart for previous month.

My CSV file have start and closed dates like below. The CSV file have last 12 month data If I load only 1 month data then my bar chart looks fine, but my requirement is load 12 month data but show only previous month data in bar chart because my other chart need to have 12 month data.

start date, closed date

2/24/2020 02:00, 2/25/2020 17:00

=MonthName(addmonths(today(),-1)) , this gives me Mar 2020 which is correct

=Max(date([Start Date.autoCalendar.YearMonth])) , this gives me 3/1/2020 which is also correct but how can I club both to get only March 2020 records in chart? any help will be appreciated .

the chart start date and closed date both should fall in Previous month, which is March 2020 in this example

Labels (1)
2 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

What you require is Set analysis. Your expression should be like this.

Sum({<[Start Date] = {">=$(=Monthstart(Addmonths(today(),-1)))<=$(=Monthend(Addmonths(today(),-1)))"},

[End Date] = {">=$(=Monthstart(Addmonths(today(),-1)))<=$(=Monthend(Addmonths(today(),-1)))"}>}Sales)

 

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
shantanuonline
Contributor
Contributor
Author

Hi, I think its working ok now, thanks a ton but now I have to put this code in all other charts

is there a way I can put that code in variable and then in chart I will count only if the variable output is True?

Also  can you also help me how can I add multiple AND in this? I need to add a wild match in above analysis to see  a certain field is = to something

count(if(WildMatch(Status ,'*Closed*'), Status))