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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
squalitooo
Contributor II
Contributor II

N-1 set analysis

Hello,

I want to calculate this formula for N-1.

Sum({<Year=, Quarter=, Month=, Week=, Date_Facture=, Date_Facture={">=$(=(YearStart(Max(Date_Calendar)))) <=$(=today(today(Date_Calendar),))"}, Type_Facture = {'FACTURES'}, Site_Facture = {'XXXX'}, Code_Client-={'CLIENTSX'}>}Montant_HT_Ligne_Facture)

I have test this but no working:

Sum({<Year=, Quarter=, Month=, Week=, Day=, Date_Facture=, Date_Facture={">=$(=(YearStart(Max(Date_Calendar),-1))) <=$(=dayend(today(Date_Calendar),-365))"}, Type_Facture = {'FACTURES'}, Site_Facture = {'XXXX'}, Code_Client-={'CLIENTSX'}>}Montant_HT_Ligne_Facture)

 

Anyone have an idea for calculate YTD N-1 (day is today N-1)

Labels (1)
1 Solution

Accepted Solutions
brunobertels
Master
Master

hi 

may be this 

this second expression return a timestamp for you use dayend () : 

 

dayend(today(Date_Calendar),-365))

brunobertels_1-1652266066265.png

 

so same day last year should be 

brunobertels_0-1652265992997.png

 

 

 

View solution in original post

3 Replies
HugoRomeira_PT
Creator
Creator

Hello,

Try the following expression:

Sum({<Year=, Quarter=, Month=, Week=, Date_Facture=,
Date_Facture={">=$(=(Addmonths(YearStart(Max(Date_Calendar)),-12))) <=$(=Addmonths(today(today(Date_Calendar),),-12))"}
, Type_Facture = {'FACTURES'}, Site_Facture = {'XXXX'}, Code_Client-={'CLIENTSX'}>}Montant_HT_Ligne_Facture)

 

I used your first expression and in order to calculate the last year, I just removed 12 months by using AddMonths(..., -12).

I hope it helps!

Best regards

Hugo Romeira

If the issue is solved please mark the answer with Accept as Solution.
If you want to go quickly, go alone. If you want to go far, go together.
brunobertels
Master
Master

hi 

may be this 

this second expression return a timestamp for you use dayend () : 

 

dayend(today(Date_Calendar),-365))

brunobertels_1-1652266066265.png

 

so same day last year should be 

brunobertels_0-1652265992997.png

 

 

 

vinieme12
Champion III
Champion III

CurrentYear YTD

Sum({<Year=, Quarter=, Month=, Week=,

Date_Facture=,

Date_Facture={">=$(=Date(YearStart(Max(Date_Calendar)),'YYYY-MM-DD')

<=$(=Date(Max(Date_Calendar),'YYYY-MM-DD')) "}

, Type_Facture = {'FACTURES'}, Site_Facture = {'XXXX'}, Code_Client-={'CLIENTSX'}>}Montant_HT_Ligne_Facture)

 

Previous Year YTD

Sum({<Year=, Quarter=, Month=, Week=,

Date_Facture=,

Date_Facture={">=$(=Date(YearStart(Max(Date_Calendar),-1),'YYYY-MM-DD')

<=$(=Date(addyears(Max(Date_Calendar),-1),'YYYY-MM-DD')) "}

, Type_Facture = {'FACTURES'}, Site_Facture = {'XXXX'}, Code_Client-={'CLIENTSX'}>}Montant_HT_Ligne_Facture)

 

Replace YYYY-MM-DD in the above expressions to match the date format of the field

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.