Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi All,
I'm new to Power BI and just wanted to know how it is possible to create a year to date vs previous year bar chart. My source data is events data over the last few years - one record per event and multiple events per day. I can create a cluster bar chart that gives me a monthly comparison since the beginning of last year but alongside it i would like a chart that shows year to date comparison vs last year (based on the last full month).
Dummy data below as an example - summary by month and year (matrix) which can be plotted as a cluster bar and no additional manipulation to the source data required. The year to date figures will exclude the partial current month.
Month | 2018 | 2019 | Period | 2018 YTD | 2019 YTD | |
Jan | 61 | 91 | Events | 441 | 394 | |
Feb | 82 | 34 | ||||
Mar | 50 | 24 | ||||
Apr | 1 | 94 | ||||
May | 58 | 81 | ||||
Jun | 62 | 25 | ||||
Jul | 87 | 41 | ||||
Aug | 40 | 4 | ||||
Sep | 3 | 35 | ||||
Oct | 85 | |||||
Nov | 40 | |||||
Dec | 45 |
Any ideas on how to proceed - do i need to create a separate summary table etc?
And as a separate question given my source data will be udpated every day how do i make both charts dynamic so i will only ever see the current year vs last year without having to hard code the years?
Thank You
Solved! Go to Solution.
Hi @Anonymous ,
we can try to use the following measure to meet your requirement.
ThisYear = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) ) )
LastYear = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) - 1 ) )
BTW, pbix as attached.
Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
we can try to use the following measure to meet your requirement.
ThisYear = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) ) )
LastYear = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( 'Table', 'Table'[Date].[Year] = YEAR ( TODAY () ) - 1 ) )
BTW, pbix as attached.
Best regards,
Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
95 | |
69 | |
44 | |
38 | |
30 |
User | Count |
---|---|
157 | |
101 | |
60 | |
42 | |
40 |