Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
I need to calculate the trend variation of an average of prices (so for example December 2024 on December 2023). I'm using a formula like this (AMListino is in YYYY/MM format and PrezzoCIM is the price of each product):
Avg( {<AMListino={"Date(AMListino, 'YYYY/MM')"}>} PrezzoCIM)
but it doesn't want to work. The dimension of the chart is AMListino.
Any ideas?
Thanks!!!
Hello,
do you want to make the average between two specified dates?
If that's it, you can use a measure of this structure:
Avg({<AMListino={">=$(='2023/12') <=$(='2024/12')"}> PrezzoCIM)
Another example, if you want to take the last years according to the max date you can use this:
sum({<AMListino={">=$(=max(DATETEST)) <=$(=date(addmonths(max(DATETEST),-12),'YYYY/MM'))"}>}IDTEST)
Thanks, but unfortunately it doesn't solve my problem. I need the monthly values by month. In practice:
- variation January 2024/January 2023
- variation February 2024/February 2023
- variation March 2024/March 2023
- variation April 2024/April 2023
and so on. In practice what you can see in the graph I attach (made in Excel)
where the percentage changes are compared to the same month of the previous year.
Hello,
Then using modifiers might help you.
https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Measures/modifiers.htm
(part Moving average)
So the output should look like this :
RangeAvg(Above( ( Sum(PrezzoCIM) ) , 0, 12))