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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
BenGielen
Contributor III
Contributor III

Calculation of data based on selected years

Hello Qlik community,

i want to make the difference from the selected year and the year before.
Example:
I filter the year 2020 and then i want to calculate a meassure that gives me a difference from 2020 to 2019. the best would be Year-to-Date.
what can the formula for the meassure look like?

Thanks in advance.

1 Solution

Accepted Solutions
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Try this

if you want to remove -ve sign you can use FABS() Function

 

Sum({<Date={">=$(=YearStart(Max(Date)))<=$(=Max(Date)"}>}Sales)

-

Sum({<Date={">=$(=YearStart(Max(Date),-1))<=$(=AddYears(Max(Date),-1))"}>}Sales)

 

Hope this helps

Thanks

Thanks and Regards
Kashyap.R

View solution in original post

2 Replies
Kashyap_R
Partner - Specialist
Partner - Specialist

Hi

Try this

if you want to remove -ve sign you can use FABS() Function

 

Sum({<Date={">=$(=YearStart(Max(Date)))<=$(=Max(Date)"}>}Sales)

-

Sum({<Date={">=$(=YearStart(Max(Date),-1))<=$(=AddYears(Max(Date),-1))"}>}Sales)

 

Hope this helps

Thanks

Thanks and Regards
Kashyap.R
BenGielen
Contributor III
Contributor III
Author

Thank you for your answer. It works.