Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can anyone help me with Set Analysis Problem on calculating the monthly total?

Hi Experts,

Thanks for taking time to look at my question.

I want to calculate the monthly total quotes(for insurance) based on different areas. 

       First. I was trying to calculate the MTD (Month to Date) total quotes by using the expression as follow, I think it works.

        =sum({<Month = {$(=Month(Today()))}, Year = {$(=Year(Today()))},QuoteDate=>}QuoteCount)

     

       Then, I want to calculate the total quotes for previous two months separately(dynamic month): Dec( from Dec.1.2015--Dec.31.2015) and         last year Novenmer,but I don't know how to do it.  The data structure is as follow picture:

Capture.PNG

Can anybody help me with it? Thanks for all your help. Appreciate it!

3 Replies
Chanty4u
MVP
MVP

jonathandienst
Partner - Champion III
Partner - Champion III

Please post a sample qvw file with some representative data.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
PrashantSangle

Hi,

are you calculating Month and Year field or it is already available in Database???

Considering you are calculating Month and Year field from QuoteDate

then

Expression for MTD

=sum({<QuoteDate={">=$(=date(monthStart(max(QuoteDate))))<=$(=date(max(QuoteDate)))"}>}QuoteCount)


MTD-1

=sum({<QuoteDate={">=$(=date(monthStart(addMonths(max(QuoteDate),-1))))<=$(=date(addMonths(max(QuoteDate),-1)))"}>}QuoteCount)


MTD-2

=sum({<QuoteDate={">=$(=date(monthStart(addMonths(max(QuoteDate),-2))))<=$(=date(addMonths(max(QuoteDate),-2)))"}>}QuoteCount)


Use AddMonths()


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂