Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
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

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

qv_testing
Specialist II
Specialist II

Hi Mohammed,

Same expression how to write in Script level..