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

Announcements
Talend Cloud AWS EU Scheduled Outage: Starting Tues 26 May 21:00 CEST with expected completion Wed 27 May 01:00 CEST
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Special YTD formula calculation

Hi everyone

I need to compare last year with current year, but just those months that have sales last year. Additionally I have just Tickets and not canceled ones, and a flag for last year sales.

Example

On one store we just have sales on dic 2014 and on 2015 all year, but I need just to compare dic 2015 vs dic 2014.

My formula look like this

sum({$<

Fecha={">=$(=date(yearstart(max(Fecha))))<=$(=date(max(Fecha)))"},

Mes=P({1<Mes={'=Sum({$< Doc *= {"T*"} - {"TS*"}, TicketCancelado ={0}, Año={$(=year(addmonths(max(Fecha),-12)))" }, Flag ={1} >} Ventas )>0'}>} Mes )

>} Ventas)

Hope somebody could help me!

Labels (1)
5 Replies
settu_periasamy
Master III
Master III

Looks like double quotes missing  here -> {$(=year(addmonths(max(Fecha),-12)))" }

May be try this

=sum({$< Fecha={">=$(=date(yearstart(max(Fecha))))<=$(=date(max(Fecha)))"},

              Mes=P({1<Mes={'=Sum({$< Doc *= {"T*"} - {"TS*"}, TicketCancelado ={0},

                                                        Año={"$(=year(addmonths(max(Fecha),-12)))"}, Flag ={1}

                                                >} Ventas )>0'}

                              >} Mes )

      >} Ventas)

jagan
Partner - Champion III
Partner - Champion III

Hi,

Check this link for similar type of expressions

Set Analysis for certain Point in Time

Regards,

Jagan.

Not applicable
Author

Hi Settu

It was a typing error, but that formula does not reflejct the spected result.

Not applicable
Author

Hi Jagan

Actually I don't have troubles with laps of time, is base on sales from an specific store, not periods of time.

jagan
Partner - Champion III
Partner - Champion III

HI,

Attach some sample data and your expected output so that it would be easier to understand and provide the solution.

Regards,

Jagan.