Looker Studioのダッシュボード上で、日付列が1列の状態のデータを使い、
指定した日付範囲に対して過去2年分を期間比較するグラフを作成したいです。
X軸に日付フィールド、
指標に今年、1年前[計算フィールド]、2年前[計算フィールド]を設定しましたが実現できませんでした。
何か他に良い方法や具体的な計算フィールドの数式が知りたいです。
Solved! Go to Solution.
I think you're on the right track!
With the month/day granularity, the year will be removed from the date. Then, we can create measures that count up the number of records for each year. For example, to create a count of all records in 2024, I could use a function like this:
SUM(CASE WHEN created year=2024 THEN 1 ELSE 0 END)
Then you can put it all together to get a table like this:
It's important to make sure the date field on the X-axis doesn't include the year. In the "Date Granularity", select "Month Day" (screenshot attached). Then your calculated fields for 1 year ago and 2 years ago should work correctly.
sam8-san
thank you for your reply.
For the X-axis date field, I selected "Month/Day" for "Date Granularity", but I was unable to display the values in parallel.
I use the following data source ①
As shown in ②, I would like to display the values for the past two years in parallel.
Is it possible with Looker Studio implementation?
---------------------
▼①data source
date value
2024/9/1 300
2024/8/1 600
2024/7/1 900
••• •••
2023/9/1 200
2023/8/1 400
2023/7/1 600
••• •••
2022/9/1 100
2022/8/1 200
2022/7/1 300
---------------------
▼②table graph
date | value(this year) | value(1 year ago) | value(2 years ago)
2024/9/1 | 300 | 200 | 100
2024/8/1 |600 | 400 | 200
2024/7/1 | 900| 600 | 300
I think you're on the right track!
With the month/day granularity, the year will be removed from the date. Then, we can create measures that count up the number of records for each year. For example, to create a count of all records in 2024, I could use a function like this:
SUM(CASE WHEN created year=2024 THEN 1 ELSE 0 END)
Then you can put it all together to get a table like this:
Sam 8-san
I was able to resolve the issue by creating a new graph and then configuring it.
thank you for teaching me.