Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ptl14624
Contributor III
Contributor III

Variation % trough years

Hi all!

I want to present a ComboChart where I could show the variation (%) for each consumable, from the last year to this one.

In general, something like the image below.

Any ideas about which formula should I use?

Thanks

Capture.PNG

 

3 Replies
OmarBenSalem

Put only Month as a dimension (not year-Monthy), consumable as second dimension

and as a measure, sthing like:

(sum({<Date,Month,YearMonth, Year={"$(=max(Year))"}>}Value)

-

sum({<Date,Month,YearMonth, Year={"$(=max(Year)-1)"}>}Value))

/

sum({<Date,Month,YearMonth, Year={"$(=max(Year)-1)"}>}Value)

 

ptl14624
Contributor III
Contributor III
Author

Thanks for your reply!

However, still some doubts:

 In this part: "$(=max(Year))" , The $ stands for what? Should I use it just like that?

Thanks

OmarBenSalem

It's a syntax thing; in a set expression

max(date) is a function so it needs an "=" sign:

=max(date)

when we have a '=' we add the $ (before each calculation) : $(=max(date) )
and then u surround the whole with doubles quotes

so : Date={"$(=max(Date))"}

if u were performing a conditon on an integer, u write it directly without quotes :
Year={2018}

if it's a string, u put quotes:

Country={'Tunisia'}