# XY Chart -\> Comparison chart by year

**URL:** <https://forum.inductiveautomation.com/t/xy-chart-comparison-chart-by-year/73627>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [May 12, 2023, 1:09am UTC](https://forum.inductiveautomation.com/t/xy-chart-comparison-chart-by-year/73627 "2023-05-12T01:09:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KIM\_SUNG\_HOO](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@KIM\_SUNG\_HOO](https://forum.inductiveautomation.com/u/KIM_SUNG_HOO)\
**Post date:** [May 12, 2023, 1:09am UTC](https://forum.inductiveautomation.com/t/xy-chart-comparison-chart-by-year/73627/1 "2023-05-12T01:09:25Z")

</div>

hi, I want to compare the values of 2022 and 2023 in one bar chart.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/ef945511e4ecb36453c8937eea23736787beb233.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/4/94398673837cfdf73eb46d696977b926e47ff518.png)

this is my data source from DB. but When I create a chart as listed, it becomes like the picture above.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/b/4bc93a692ad235f6c92fd4ac409516ea23b82a20.png)

This is the comparison chart I want. I would like to know how to change it to look like this picture.

thanks for reading!

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [May 12, 2023, 10:04am UTC](https://forum.inductiveautomation.com/t/xy-chart-comparison-chart-by-year/73627/2 "2023-05-12T10:04:04Z")

</div>

2022 and 2023 data points need to be together in the same 'row'

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/b/6bfbe6d15b4c456c5613eb37ca45459760c150f5.png)

---

<div class="post-metadata">

**Author:** ![KIM\_SUNG\_HOO](https://avatars.discourse-cdn.com/v4/letter/k/977dab/32.png) [@KIM\_SUNG\_HOO](https://forum.inductiveautomation.com/u/KIM_SUNG_HOO)\
**Post date:** [May 15, 2023, 12:41am UTC](https://forum.inductiveautomation.com/t/xy-chart-comparison-chart-by-year/73627/3 "2023-05-15T00:41:51Z")

</div>

> [@JordanCClark](#):
>
> 2022 and 2023 data points need to be together in the same 'row'

I want to too. Is it possible to create it using queries?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [May 15, 2023, 2:13am UTC](https://forum.inductiveautomation.com/t/xy-chart-comparison-chart-by-year/73627/4 "2023-05-15T02:13:26Z")

</div>

> [@KIM\_SUNG\_HOO](#):
>
> Is it possible to create it using queries

You could do something like this:

```auto
SELECT t1.Date, t1.Value AS Value2022, t2.Value AS Value2023
FROM yourTableName t1
JOIN yourTableName t2 ON t1.Date = t2.Date
WHERE YEAR(t1.Date) = 2022 AND YEAR(t2.Date) = 2023

```

Change Date to the name of your date column, and change Value to the name of your value column
