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

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 II
Creator II
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 II
Creator II
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 II
Creator II
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 II
Creator II
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.