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