Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
oze
Contributor
Contributor

Calculating PYTD YTD profits

Hello,

I am new to qlikview and i want to calculate the clean profits from the previous year to day versus year to day having the below data and their differences.

DATE

VALUE

 

DATE

VALUE

31/01/2022

   100,00 €

 

31/01/2023

   150,00 €

28/02/2022

   101,00 €

 

28/02/2023

   150,00 €

31/03/2022

   102,00 €

 

31/03/2023

     90,00 €

30/04/2022

   103,00 €

 

30/04/2023

     80,00 €

31/05/2022

   104,00 €

 

31/05/2023

     20,00 €

30/06/2022

   105,00 €

     

30/07/2022

   105,00 €

     

31/08/2022

   107,00 €

     

30/09/2022

   108,00 €

     

31/10/2022

   109,00 €

     

30/11/2022

   110,00 €

     

31/12/2022

   111,00 €

     

 

 RESULT

 

pytd

ytd

Diff%

   510,00 €

   490,00 €

 
Labels (1)
1 Reply
MayilVahanan

Hi

Try like below,

Hope you have Year field

YTD =Sum({<Year={$(=Max(Year))}>}VALUE)

PYTD =Sum({<Year={$(=Max(Year)-1)}, Date={"<=$(=AddYears(Max(Date),-1))"}>}VALUE)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.