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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
janardhan
Creator
Creator

Month wise sum

Hi Friends,

This is my expression:  =sum({<BD_Year={'=$(vCurrentYear)'}>}Gross_Premium)

For above expression i am getting values like total sum for 2014. but i need upto this year current month total Gross_Premium.

Please help me

Labels (1)
1 Solution

Accepted Solutions
ashfaq_haseeb
Champion III
Champion III

Hi,

You need to look at YTD amd MTD.

YTD Expression

=Sum({$<Datefield = {'>$(=Max((YearStart(Today())))) <=$(=Max(Today()))'}>} Sales)

Or

=Sum({$<Datefield = {'>$(=Max((YearStart(Datefield)))) <=$(=Max(Today()))'}>} Sales)

MTD Expression

=Sum({$<Datefield = {'>=$(=Max((MonthStart(Today())))) <=$(=Max(Today()))'}>} Sales)

Or

=Sum({$<Datefield = {'>=$(=Max((MonthStart(Datefield)))) <=$(=Max(Today()))'}>} Sales)

Regards

ASHFAQ

View solution in original post

5 Replies
ajaykumar1
Creator III
Creator III

Try like this;

=sum({<BD_Year={"<=$(=MAX(PERIOD))"}>}Gross_Premium)


In the PERIOD place use your datefield which indicates the upto current month.


Regards,

Ajay


ashfaq_haseeb
Champion III
Champion III

Hi,

You need to look at YTD amd MTD.

YTD Expression

=Sum({$<Datefield = {'>$(=Max((YearStart(Today())))) <=$(=Max(Today()))'}>} Sales)

Or

=Sum({$<Datefield = {'>$(=Max((YearStart(Datefield)))) <=$(=Max(Today()))'}>} Sales)

MTD Expression

=Sum({$<Datefield = {'>=$(=Max((MonthStart(Today())))) <=$(=Max(Today()))'}>} Sales)

Or

=Sum({$<Datefield = {'>=$(=Max((MonthStart(Datefield)))) <=$(=Max(Today()))'}>} Sales)

Regards

ASHFAQ

janardhan
Creator
Creator
Author

Thanks Mohammed

ashfaq_haseeb
Champion III
Champion III

welcome

Regards

ASHFAQ

Nagaraju_KCS
Specialist III
Specialist III

Hi Mohammed,

Same expression how to write in Script level..