Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
115 | |
99 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |