Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

kavita25
Valued Contributor

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
Honored Contributor III

Re: YTD for the below expression..

Try

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

Re: YTD for the below expression..

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
Valued Contributor

Re: YTD for the below expression..

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.

Re: YTD for the below expression..

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

Re: YTD for the below expression..

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


talk is cheap, supply exceeds demand
kavita25
Valued Contributor

Re: YTD for the below expression..

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).

Highlighted

Re: YTD for the below expression..

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

kavita25
Valued Contributor

Re: YTD for the below expression..

PFA

Re: YTD for the below expression..

Which sheet are we looking into?

Community Browser