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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
ttal7878
Creator
Creator

PMTD

Hi,

I have the following expression that display the sum of Sale_Amount$ of previous month:

=Sum({<Year=,Month=,Date=, DateKey={">=$(=Num(MonthStart(Max(DateKey), -1)))<=$(=num(max(MonthEnd(DateKey,-1))))"}>} Sale_Amount$)

I would like to modify the 'less than' portion to give me the beginning of previous selected month in a number format.

For example: if the user selects Month-02.2017 than the calculation will take into account the following dates:

01-01-2017 till 31-01-2017


Thanks



Labels (1)
4 Replies
mdmukramali
Specialist III
Specialist III

Dear,

you can attach sample data set so that we can help you.

Thanks,

Mukram

pathiqvd
Creator III
Creator III

Hi,

Try this,

In script write  like as date(MonthName(datefield),'MM.YYYY') as mnth_year

and write expr like

=Sum({<mnth_year={"$(=date(addmonths(max(mnth_year),-1),'MM.YYYY'))"}>}Sales)

and take mnth_year field as filter.


Regards,

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

=Sum({<Year=,Month=,Date=, DateKey={">=$(=Num(MonthStart(Max(DateKey), -1)))<=$(=num(MonthEnd(Max(DateKey),-1)))"}>} Sale_Amount$)


Rergards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ttal7878
Creator
Creator
Author

Attached is a sample report

I want to know if the calculation is correct