Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
millsaz69
Contributor
Contributor

Chart Showing Last 12 Months based on Max Date filter

I am trying to build a line chart showing each month for the last 12 months count of the "LeadType" value.  When the user selects the dates from the filter pane, the Max(Date) would be used to determine the last 12 months.  I've found so many different ways people have done similar calculations, but none seem to work.  

Here is my last attempt before posting the question:

Dimension:

=[Date.autoCalendar.MonthYear]

Measure:

=Count({$<MonthsAgo={">=0<12"}>} LeadType)

5 Replies
Taoufiq_Zarra

can you share a sample data ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
millsaz69
Contributor
Contributor
Author

Unfortunately, I am not able to post the data to the internet.   I just need the total count of the "LeadTypes" for each month for 12 months based on the max date selected by the user in the filter pane.

Here is the format of the data:

LeadDate, LeadType

'MM/DD/YYYY',  NEWSLETTER

Lead Types

NEWSLETTER

CATALOG

CONTACT

SAMPLE

DOWNLOAD

 

millsaz69
Contributor
Contributor
Author

This is the current bar chart showing the filtered months.  I just need it to show prior 12 months from max date (Dec 2019).

sample.png

millsaz69
Contributor
Contributor
Author

I have tried this expression and when I select a date in the filter pane it filters the data.  

count({<vMaxDate = {"$(='>=' & Date(AddYears(vMaxDate, -12), 'MM/DD/YYYY') & '<=' & Date(vMaxDate, 'MM/DD/YYYY'))"}>}LeadType)

Taoufiq_Zarra

sample data is necessary to understand. But that's okay.


Are you only looking for the last 12 months counts, I suggest you to compare the dates and not the months.


Is this formula okay ?

 

=Count({$<DateAgo= {">=$(=AddMonths(Date(Today(),'MM/DD/YYYY'),-12))"}>} LeadType)
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉