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: 
rupaliqlik
Partner - Creator
Partner - Creator

Calculate Y-1 Actual

Hi folks

I want to calculate below logic.

Logic for Expression:Y-1 ACT

->Total amount of the same month of previous year / date count of the month * day number

For E.g., it is 22nd of August today.

Get the total amount of Aug 2020, divided by 31, then multiply by 22.

Please help me to solve this issue.

3 Replies
AshutoshBhumkar
Partner - Specialist
Partner - Specialist

Hi,

You can use below simple set expressions.

 

Set for PY Sales Amount : Addyears(Today(),-1) : 22-Aug-2020

Date count of the month : Date(Monthend(Addyears(Today(),-1)),'dd') : 31

Day Number : Day(Addyears(Today(),-1)) : 22

 

Thanks,

Ashutosh

rupaliqlik
Partner - Creator
Partner - Creator
Author

How to write all in one expression.In set analysis?

Kushal_Chawda

@rupaliqlik  try below

= sum({<DateField ={">=$(=monthstart(addyears(today(1),-1)))<=$(=monthend(addyears(today(1),-1)))"}>} Amount) / (day(MonthEnd(Today(1))) * day(Today(1)))

or

= sum({<DateField ={">=$(=monthstart(addyears(max(DateField),-1)))<=$(=monthend(addyears(max(DateField),-1)))"}>} Amount) / (day(MonthEnd(max(DateField))) * day(max(DateField)))