Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Louveduval
Creator
Creator

Calculation to date

Hello , 

I'm sorry to bother you , I don't undertand why I haven't the good result . 

I would like to have que quantity for the same day but last year 

Sum({$<
    [Filtre CA vente] = {"Oui"},
[Type date] = {'BL vente','Facture vente'},
       Date = {"<=$(=Date(AddYears(RangeMin(Max(Date),Today()),-1)))"}  --07/09/2023
>}[Quantité vente])

 

But if I made that  I've the quantity since same day Y-1

I need to made that but 

Sum({<
[Filtre CA vente] = {"Oui"},
[Type date]={'BL vente','Facture vente'},
Date = {"<=$(=Date(AddYears(RangeMin(Max(Date),Today()),-1)))"},-- 07/09/2023
AnnéeMois={"$(=MonthName(AddYears(RangeMin(Max(Date),Today()),-1)))"}-- 09/2023
>}[Quantité vente])

Why I need to repeat the month year  ? 


Labels (2)
3 Replies
Chirantha
Support
Support

The reason you need to repeat the month and year in your second expression is that without this condition, the set analysis expression will include all data from before the specified date, not just data from the same day last year. By adding this condition, you are ensuring that only data from the same month and year last year is included in the calculation. I hope this answers your question!

Louveduval
Creator
Creator
Author

Yes but it's strange , why just a filter doesn't work ? 
In my set, I ask for one date . Why qlik thinks that I need the other date ? 

In my expression I ask 3 filter for the sum : if it's on the CA , one kind of date , and one date . 

It's like if I ask in a pet shop   how many of white bunnies have blue eyes  and he give me all white bunnies .
I need to ask  how many of white bunnies have blue eyes , who have blue eyes  . 
it's that than I don't understand :c 

It's not possible to make like CSS an ! Important  than to repeat ? 

Louveduval
Creator
Creator
Author

And another question , why it does't work ? 

Sum({<
[Filtre CA vente] = {"Oui"},
[Type date]={'BL vente','Facture vente'},
Date = {"<=$(=Date(RangeMin(Max(Date),Today())))"},
AnnéeMois={"$(=MonthName(RangeMin(Today(),Max(Date))))"}
>}[Quantité vente])

It give me the total of the month  and not just for today 😞