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: 
gautik92
Specialist III
Specialist III

How to Achieve this

I am attaching files

if yu see the qvw file I am calculating YTD in script for month wise.that is working fine. but if I take age as dimension it is not working

its showing wrong values.

any ideas

thanks in advance

10 Replies
Kushal_Chawda

Create YTD Flag like this

Data:

LOAD *,

           YearToDate(Period1,0,4)*-1 as Flag

FROM table;

Now use expression like below

=sum({<Flag={1}>} Value)

gautik92
Specialist III
Specialist III
Author

will it work if I select a month

gautik92
Specialist III
Specialist III
Author

Supppose if I select July 2017 it shud show value summing up from April 2017 to July 2017

Kushal_Chawda

Yes. It will work

Data:

LOAD *,

            monthname(Period1) as MonthYear,

           YearToDate(Period1,0,4)*-1 as Flag

FROM table;

Kushal_Chawda

But why you want Apr 17 to Jul 17 when jul 17 is selected, it should ideally display only Jul 17 no?

gautik92
Specialist III
Specialist III
Author

yes if I select july 17 it shud sum up value from apr 17 to till date and show

Kushal_Chawda

You can exclude the selection of your other periods for YTD,

Data:

LOAD *,

            monthname(Period1) as MonthYear,

           YearToDate(Period1,0,4)*-1 as Flag

FROM table;

expression

Sum({<Flag={1},MonthYear>}Leavers)

gautik92
Specialist III
Specialist III
Author

this is not working

vinieme12
Champion III
Champion III

See this post

The As-Of Table

Calculating rolling n-period totals, averages or other aggregations

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.