Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
divya_anand
Creator III
Creator III

Only previous month's data in a bar chart?

Hi all, I hope someone out there can help me with this.

I have 3 fields- Month, region, sales.

I want to see a bar chart with only the previous month's sales with the Region on x-axis.

For ex, if the data I have is this:

MonthRegionSales
marnorth78518751
junenorth28632982
junewest2378638
junecentral2369386
julysouth8136328
junesouth3863893

Now I want to see a bar chart which shows values (north, west, central, south) on x-axis (Since June is the previous month) with respective values on the bars.

Thank you.

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

Hi Divya,

Attaching two possibilities for your query. please see attached QVW.

BarChart_PrevMonth.JPG

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

View solution in original post

4 Replies
sunny_talwar

If Month is a dual field, you can try this:

Sum({<Month = {"$(=MaxString(Month, 2))"}>} Sales)

Alternatively, I prefer using a date field over a month field. Do you have a date field in your application?

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

vinieme12
Champion III
Champion III

Hi Divya,

Attaching two possibilities for your query. please see attached QVW.

BarChart_PrevMonth.JPG

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

This works. Just that I had to apply the condition on the dimension rather than the expression. Thank you.

vinieme12
Champion III
Champion III

Glad to help

Cheers

V

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