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: 
psk180590
Creator III
Creator III

YTD in qlikview

Hello All,

I'm looking to generate a chart for YTD current year vs YTD last year. I have many values to calculate(Sales, Quantity, Per Country, Per State, Per Region etc.,). Each of this will be having a separate chart.

Can you please help me with a single variable to define YTD current year and another one to define YTD last year.

I would like to use this in the chart expressions.

Thanks,

Best Regards

Sai.

14 Replies
prma7799
Master III
Master III

Please check below using this you can create variable and use it in you application

YTQ, QTD, MTD and WTD

Previous YTQ, QTD, MTD and WTD

PrashantSangle

create 2 variable

Considering you have proper date field

1 for YTD like

'=$(>=YearStart(max(datefieldName))<=(date(max(dateFieldName))))'

2 for LY-YTD like

'=$(>=YearStart(AddYears(max(datefieldName),-1))<=(date(AddYears(max(dateFieldName),-1))))'

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
psk180590
Creator III
Creator III
Author

Hello Prashant,

I'm using the below formula. But, it doesn't give me any values

SET vDate_APO_YTD = =">$(=YearStart(max(APORegion.Date))<=(date(max(APORegion.Date))))}>";


SET vDate_APO_YTD_VJ = =">$(=YearStart(AddYears(max(APORegion.Date),-1))<=(date(AddYears(max(APORegion.Date),-1))))}>";


Could you please check if i'm missing anything here.

PrashantSangle

What is your expression in set analysis????

In chart you have to use those variable

Try like

sum({<dateField={"=$vDate_APO_YTD"}>}Sales)

and

sum({<dateField={"=$vDate_APO_YTD_VJ"}>}Sales)


Note : Please check syntax of expression. I am bad with syntax


Regards,

Prashant

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
psk180590
Creator III
Creator III
Author

Hello All,

For some reason i'm not able to get the desired result. I'm attaching my test data here for reference can you please have  look and suggest me what i might be doing wrong.

psk180590
Creator III
Creator III
Author

I'm looking to get the Sales(2017 YTD) vs Sales(2016 YTD) and also Sales_Total in the same format.

psk180590
Creator III
Creator III
Author

jagan

I have seen your post regarding the same topic but, some how i'm not able to follow your suggestions. Can you please help me on this.

Anonymous
Not applicable

YTD:

=sum({<Date={">=$(=Yearstart(today()))<=$(today())"} >} Sales)

Y-1TD-1:

sum({<Date={">=$(=Yearstart(today(),-1))<=$(=AddYears(today(),-1))"} >} Sales)

psk180590
Creator III
Creator III
Author

Hello Robin,

Thanks very much for your response.

The YTD (current year) formula works perfectly but the YTD (last year) gives me same values as YTD current year.