Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Q&A with Qlik - Qlik Cloud Migration: Questions about migrating to Qlik Cloud? Catch the latest replay!
cancel
Showing results for 
Search instead for 
Did you mean: 
Ethel
Creator III
Creator III

Show data for the last max available period

Hello, could you please help me modify my set analysis. Unfortunately it is not working now. 

Let's say, I have data only for 2021 year.(Months are optional, user may chose one or several month or may not, then we are working with the year ). In this case if 2022 is chosen, I don't have ay data and getting an error message in the chart. If I change year to 2021, I have data in my chart. Could you please help me to write set analysis, to show las max period if I don't have data for the period that was chosen by end user. 

This is my current formula

avg({<Year = {$(=Max(Year))}>}aggr(only({<Year = {$(=Max(Year))}  Amount),ID))

 

Thanks a lot in advance!

Labels (5)
3 Replies
RsQK
Creator II
Creator II

Hi, not knowing your data model seems like this could work:

avg({<Year={$(=MAX({<ID*={"*"}>}Year))}>}Amount)
Ethel
Creator III
Creator III
Author

Hello @RsQK , thank you very much for your answer. I'm sorry, it take me some time to answer. 

Should I put something instead of stars(ID*={"*"}) or it's punctuation and I should leave it as is?

Thank you very much in advance!

Ethel
Creator III
Creator III
Author

Hello, I've simplified my my formula to 

Sum(
{<Year = {'$(=Max(Year))'}>} Amount) But for some reason formula is not working and shows data only when 2020 year is chosen. When I chose 2022, it doesn't show data. What can be wrong? 

Thanks a lot in advance!