Hello. This is again me. Is there any way to see c...
# gd-beginners
a
Hello. This is again me. Is there any way to see columns difference in % ? I have this table, and I want to see difference in % by years.
m
Hi Alexander, It will require you to create couple of custom metrics. Something like this could help: • Metric 1 (Current year):
Copy code
SELECT (SELECT SUM(fact)) where Year (Date) = this and Day of Year (Date) < this
• Metric2 (Previous year):
Copy code
SELECT (SELECT SUM(fact)) where Year (Date) = this - 1 and Day of Year (Date) < this -1
• Metric 3 (% change):
Copy code
SELECT "Current year" / "Previous year" -1
You can find more information about the THIS macro here: https://help.gooddata.com/pages/viewpage.action?pageId=86788177
a
Thank you
gd logo 1
m
And let me take this opportunity to invite you to join our free courses in our GoodData university: https://university.gooddata.com/getting-started-with-maql
❤️ 1
j
other option is to use FOR PREVIOUS. Example:
Copy code
select sum(fact)/(select sum(fact) for previous (Year (Date)) -1
such metric can be broken down by Year(Date) attribute and will display % difference between the years. The solution with time macro “this” in previous posts compares only current (this) year with previous year.