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: 
stephenedberkg
Creator III
Creator III

YTD

I attach the sample app

YTD value are not coming correct?

1 Solution

Accepted Solutions
sunny_talwar

Try this expression:

=Sum({<Year={$(=Max(Year))}, Months, Year, Month, MonthID = {"<=$(=Max(MonthID))"}>}

Aggr(If(Only({1}MonthIDS) = Max(TOTAL <ID> {<Month>} MonthID) + Only(TOTAL <ID> {<Month>} [lock period]),

Sum({<Year={$(=Max(Year))}, Months, Year, Month, MonthID = {"<=$(=Max(MonthID))"}>}sales)), ID, MonthIDS))


Capture.PNG

View solution in original post

11 Replies
PradeepReddy
Specialist II
Specialist II

create a variable as vMaxMonth=Max(MonthID)

Use that variable in set analysis..

stephenedberkg
Creator III
Creator III
Author

Dear pradeept

i tried this but its not working

sunny_talwar

What is the expected output you are hoping to see and in which object? Bar Chart or Text Box object?

stephenedberkg
Creator III
Creator III
Author

if i select Feb i want to see both jan and feb values in bar chart

sunny_talwar

Try this expression:

=Sum({<Year={$(=Max(Year))}, Months, Year, Month, MonthID = {"<=$(=Max(MonthID))"}>}

Aggr(If(Only({1}MonthIDS) = Max(TOTAL <ID> {<Month>} MonthID) + Only(TOTAL <ID> {<Month>} [lock period]),

Sum({<Year={$(=Max(Year))}, Months, Year, Month, MonthID = {"<=$(=Max(MonthID))"}>}sales)), ID, MonthIDS))


Capture.PNG

stephenedberkg
Creator III
Creator III
Author

Dear Sunny,

thank you

this is working correct in sample app

but while i applied in my app its not working correctly

please find attachment

sunny_talwar

Did it work?

stephenedberkg
Creator III
Creator III
Author

Dear sunindia


its working on that sample app only but its not working in my apps


i had post the app in previous command

sunny_talwar

Will be checking it.