Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

QTD

Hi Experts,

I would like to know how Quarter Till Date(QTD) logic wil work .

Can any one explain with some sample data.

Thanks

11 Replies
buzzy996
Master II
Master II

Current Year QTD

=num(sum({$<Year = {$(=only(Year))}, Quarter = {$(=only(Quarter))}, Month = {"<=$(=max(Month))"}>} LineSalesAmount), '$#,##0;($#,##0)')

Previous Year QTD

=num(sum({$<Year = {$(=only(Year) - 1)}, Quarter = {$(=only(Quarter))}, Month = {"<=$(=max(Month))"}>} LineSalesAmount), '$#,##0;($#,##0)')

chematos
Specialist II
Specialist II

Hi,

QTD is the cumulative result from 1st day of the quarter to the current day. Lets say you have sales amount everyday, e.g:

You want to calculate the QTD sales, being filtered 25/03/2015, so QTD should add sales amount from 1st January to 25/03/2015, as your current point of view is the first Quarter.

If your filter is for example 19/07/2014, then you are at Quarter 3, so QTD for Q1 is the cumulative sales amount of whole Q1, the same for Q2, and for Q3 should be from 1st of July till 19/07/2014

Hope this helps.

Regards,

Jose

Not applicable
Author

Thank you very nice explanation.

so how do we achieve this QTD, lets say I need to calculate the sales amount till today.

So how we can achieve,i think we need to use set analysis. How do we write set analysis function here???

Thanks

buzzy996
Master II
Master II

hi,are u tried the above expressions?

chematos
Specialist II
Specialist II

Look Shiva expressions

Not applicable
Author

Thanku , I tried your expression but facing some error.

=Sum({$< Year = {$(#vYear)}, Quarter = {$(#vQuarter)} , Month = {<=$(#vMonth)}>} sales)

Any one correct me where i was wrong.

buzzy996
Master II
Master II

can u try this,else share ur error?

=num(sum({$<Year = {$(=only(vYear))}, Quarter = {$(=only(vQuarter))}, Month = {"<=$(=max(vMonth))"}>} sales), '$#,##0;($#,##0)')

Anonymous
Not applicable
Author

There is no need for set analysis here.  Use function InQuarterToDate

Current quarter:

=sum(if(InQuarterToDate(Date, today(),0), sales))

Previous Quarter:

=sum(if(InQuarterToDate(Date, today(),-1), sales))

Previous Year same Quarter:

=sum(if(InQuarterToDate(Date, today(),-4), sales))

Karim_Khan
Creator III
Creator III

Hi Shiva,

     By Applying your expression its giving me the MTD data.Not QTD data.

Regards,

KK

KK