Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
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.
Solved! Go to Solution.
Hello @creynolds ,
According to my understanding, you want to compare with the same month’It's worth two years, isn't it?
Here's my data sample:
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:
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
Hello @creynolds ,
According to my understanding, you want to compare with the same month’It's worth two years, isn't it?
Here's my data sample:
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:
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 , 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.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
86 | |
82 | |
42 | |
40 | |
35 |