Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Use Bar Chart to Show Year-Over-Year Comparison

I have an Excel table with the calendar year 2018 (Jan-Dec) and 2019 (Jan-Dec) listed in Column A; total of 24 rows.    In column B, I have a list of #'s next to each of these months.    How can I create a bar chart that will show January 2018 and January 2019 together side-by-side; February 2018 and February 2019 side-by-side, etc.     Basically, I want to compare each of the individual months from 2018 with the previous 2019 months.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @creynolds ,

According to my understanding, you want to compare with the same monthIt's worth two years, isn't it?

Here's my data sample:

8.19.7.png

You can use the following formula:

monthColumn =
YearMonth[A]. [Month]
yearColumn =
YEAR ( 'YearMonth'[A] )

My stacked bar chart and bar chart with groups look like this:

8.19.8.jpg8.19.9.PNG

Is the result what you want? If you have any questions, upload some data samples and expected output.

Please mask sensitive data before uploading.

Best regards

Eyelyn Qin

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hello @creynolds ,

According to my understanding, you want to compare with the same monthIt's worth two years, isn't it?

Here's my data sample:

8.19.7.png

You can use the following formula:

monthColumn =
YearMonth[A]. [Month]
yearColumn =
YEAR ( 'YearMonth'[A] )

My stacked bar chart and bar chart with groups look like this:

8.19.8.jpg8.19.9.PNG

Is the result what you want? If you have any questions, upload some data samples and expected output.

Please mask sensitive data before uploading.

Best regards

Eyelyn Qin

Anonymous
Not applicable

Thanks much!
amitchandak
Super User
Super User

@Anonymous , If you have a date or create a date you can use time intelligence. Or you have to use the rank way.

Create date from month year

New column

Date = "01-" & [Month] & "-" & [Year] // when month is Jan or January format

Date = Date([Year],[Month],01) // when month is a number

 

Now try MTD, previous month

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
previous month value =  CALCULATE(sum('table'[total hours value]),previousmonth('Date'[Date]))
Last year same month value =  CALCULATE(sum('table'[total hours value]),previousmonth(dateadd('Date'[Date],-12,MONTH)))

 

Power BI — MTD
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e

 

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

See if my webinar on Time Intelligence can help: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-YTD-LYTD-Week-Over-Week/m-p/1051626#M184


Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.