Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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..