Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
kavita25
Partner - Specialist
Partner - Specialist

YTD for the below expression..

Hi,

Please help me with the logic for YTD..

My expression is :

sum(If(Val_Date >= Cal_MonthYear and Val_Date < AddMonths(Cal_MonthYear, 1), [Net Tractor Revenue (Domestic)]))

/

sum(If(Link_Date >= Cal_MonthYear and Link_Date < AddMonths(Cal_MonthYear, 1), [Net Tractor Revenue (Domestic)])))

I want to show YTD with the above expression..

For e.g If i select Sep Month then it should show from Apr to Sep..

stalwar1gwassenaar

Regards,

Kavita

15 Replies
shraddha_g
Partner - Master III
Partner - Master III

Try

sum({<Val_Date = {">=$(=date(yearstart(max(Val_Date),0,4)))<=$(=date(max(Val_Date)))"},Cal_MonthYear=>} [Net Tractor Revenue (Domestic)])

sunny_talwar

How about this?

Sum({<Val_Date = {"=Only({<Cal_MonthYear>} Val_Date) >= Only({<Cal_MonthYear>} Cal_MonthYear) and Only({<Cal_MonthYear>} Val_Date) < AddMonths(Only({<Cal_MonthYear>} Cal_MonthYear), 1)"}>} [Net Tractor Revenue (Domestic)])

/

Sum({<Link_Date = {"=Only({<Cal_MonthYear>} Link_Date) >= Only({<Cal_MonthYear>} Cal_MonthYear) and Only({<Cal_MonthYear>} Link_Date) < AddMonths(Only({<Cal_MonthYear>} Cal_MonthYear), 1)"}>} [Net Tractor Revenue (Domestic)])

kavita25
Partner - Specialist
Partner - Specialist
Author

Its not working...

I want to show this in line chart Monthly trend...where on selection of any month..

It should show from Apr to selection Month..

Dimension Is Month and Expression as mentioned before.

sunny_talwar

Can you check both the expressions individually to see if one of them works? If one works, we can just focus on the other

Gysbert_Wassenaar

Please post a small Qlik Sense app with example data that demonstrates the problem.


talk is cheap, supply exceeds demand
kavita25
Partner - Specialist
Partner - Specialist
Author

Yes..I checked..its not working..

Cal_MonthYear is Calendar Field..

and ValDate, Link Date are the tables field..

I am not linking the Calendar with these dates..and my Year & Month filters are Calendar fields filters...

So I want to show YTD on the basis of Calendar(Year & Month filters).

sunny_talwar

I think it would be easier to understand what you are trying to do, if you can share a small sample

kavita25
Partner - Specialist
Partner - Specialist
Author

PFA

sunny_talwar

Which sheet are we looking into?