Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Fixed YTD

Hi Experts,

i need to calculate YTD sales.

i m using the below expression

Sum({<Year=, MonthYear =,Date= {">=$(=date(YearStart(vMaxSalesDate)))<=$(=date(vMaxSalesDate))"}>}sales)

where vMaxSalesDate = Max(Date)


the expression is correct and working fine.


it is giving sales from year start till date.


the problem is when i select a month in the middle, ex: if i select Sep 2015. the sales value changes as year start till sep 2015 end.


but my requirement is to keep YTD fixed.


Whatever calendarmonth or calendar date may be selected, the YTD value should be fixed as Jan2015 till 9/12/2015.


how can i do this. pls help me on the expression.


1 Solution

Accepted Solutions
settu_periasamy
Master III
Master III

Hi,

May be change your variable expression like

Max ({1}Date)

Edit:

The above expression for till date..

You can directly apply this in your expression because you are using same variable in both criteria..like

Sum({<Year=, MonthYear =,Date= {">=$(=date(YearStart(vMaxSalesDate)))<=$(=date(max ({1}Date)))"}>}sales)

Where vMaxSalesDate Max (Date)

View solution in original post

4 Replies
Not applicable
Author

hi

can you please help me on my expression

settu_periasamy
Master III
Master III

Hi,

May be change your variable expression like

Max ({1}Date)

Edit:

The above expression for till date..

You can directly apply this in your expression because you are using same variable in both criteria..like

Sum({<Year=, MonthYear =,Date= {">=$(=date(YearStart(vMaxSalesDate)))<=$(=date(max ({1}Date)))"}>}sales)

Where vMaxSalesDate Max (Date)

effinty2112
Master
Master

Hello,

Try

Sum({<Year = {$(=max(Year)}, MonthYear =, Date =>}sales)