Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
LuisM
Contributor III
Contributor III

Set Analysis

Hola, soy nuevo en Qlik

 

Quisiera saber como hacer un set analysis con 2 dimensiones de tiempo entre un YearToDate y un LastYearToDate, si es que esto es posible. Hice lo mismo pero con AÑO y si me salió pero ahora quiero hacerlo con el MES

Actualmente tengo esto:

YTD

Sum({<Year={$(=Max(Year))}>} [Monto Mn Bruto SKU])

LYTD

Sum ({<Year={$(=Max(Year)-1)}>}[Monto Mn Bruto SKU])

 

Quiero que al filtrar el mes también me de los datos comparados ya que no lo sucede así. Espero me puedan ayudar

 

 

 

Labels (2)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

No, the filtering must be done on the same field, the above comparison with year field will look like

Yearfield = {">=2022-01-01<=2022-05-25"}

now Yearfield has values 2022,2021,2020 etc  these are not comparable to date values 2022-01-01, 2022-01-02 etc

makes sense??

You need to filter on the Datefield to filter dates

the Yearfield to filter Year

or the month field to filter months

 

refer this

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

 

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

View solution in original post

5 Replies
vinieme12
Champion III
Champion III

Current Year YTD

Sum({<Date = {">=$(=Date(yearstart(Max(Date)),'YYYY-MM-DD'))<=$(=Date(Max(Date),'YYYY-MM-DD'))"} >} [Monto Mn Bruto SKU])

 

Previous Year YTD

Sum({<Date = {">=$(=Date(yearstart(Max(Date),-1),'YYYY-MM-DD'))<=$(=Date(addyears(Max(Date),-1),'YYYY-MM-DD'))"} >} [Monto Mn Bruto SKU])

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

Hi Vinie

 

When l use it, now change me the amount

LuisM_0-1653401206582.png

 

the comment apply only for the year  and already gives me the correct amount but when i try this new one, the amount gives me the Total amount but not the YTD and and LYTD, what lm doing wrong? 

LuisM_1-1653401393935.png

 

Thanks for help me! 

 

vinieme12
Champion III
Champion III

Hi, you need to refer the DateField name in your data,.

Replace Datefield from below to the DateField name in your data 

Replace YYYY-MM-DD, to match the date format of your datefield

 

Current Year YTD

Sum({<Datefield = {">=$(=Date(yearstart(Max(Datefield)),'YYYY-MM-DD'))<=$(=Date(Max(Datefield),'YYYY-MM-DD'))"} >} [Monto Mn Bruto SKU])

 

Previous Year YTD

Sum({<Datefield = {">=$(=Date(yearstart(Max(Datefield),-1),'YYYY-MM-DD'))<=$(=Date(addyears(Max(Datefield),-1),'YYYY-MM-DD'))"} >} [Monto Mn Bruto SKU])

 

 

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

Hi, 

So that Datafield in this case could be my Year ? 

I will try this changing my date format because on DB comes DD-MM-YYYY, so if l try this, is correct?

 

Sum({<Year = {">=$(=Date(yearstart(Max(Year)),'DD-MM-YYYY'))<=$(=Date(Max(Year),'DD-MM-YYYY'))"} >} [Monto Mn Bruto SKU])

 

 

 

 

vinieme12
Champion III
Champion III

No, the filtering must be done on the same field, the above comparison with year field will look like

Yearfield = {">=2022-01-01<=2022-05-25"}

now Yearfield has values 2022,2021,2020 etc  these are not comparable to date values 2022-01-01, 2022-01-02 etc

makes sense??

You need to filter on the Datefield to filter dates

the Yearfield to filter Year

or the month field to filter months

 

refer this

https://community.qlik.com/t5/Qlik-Design-Blog/Dates-in-Set-Analysis/ba-p/1472511

 

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