Forum Discussion
Current Year week to Last Year same Week
Hi Everyone,
I wanted to build a visual which should show the revenue of current year selected week to previous year of same selected week alognwith legend on visual. I want to create a stack chart, for eg. If I select slicer year 2025-34 (year week) then it should show me 2 bar ie. 2025-34 week revenue with legend and 2024-34 week revenue with legend.
Please help how to do this.
Hi Kundan_RR ,
I have replicated the scenario, It is not possible to generate the expected output visual which was provided by you. Please refer below PBIX file.
Regards,
Dinesh
14 Replies
- rajendraongole1Super User
Hi Kundan_RR - I hope you have a seperate date table with year and week number concatenate.
YearWeek = Year & "-" & WeekNum
Please find the attached pbix file.
Hope this helps.
- rohit1991Super User
Hi Kundan_RR
Below are the steps to follow:
1. Create Date table
Date = ADDCOLUMNS ( CALENDAR ( DATE(2024,1,1), DATE(2025,12,31) ), "ISO Week", WEEKNUM ( [Date], 21 ), "ISO Year", YEAR ( [Date] - WEEKDAY ( [Date], 2 ) + 4 ), "Year-Week", FORMAT ( YEAR ( [Date] - WEEKDAY ( [Date], 2 ) + 4 ), "0000" ) & "-" & FORMAT ( WEEKNUM ( [Date], 21 ), "00" ) )Mark this as Date table and relate it with your Sales table on OrderDate.
2. Measures
Total Sales = SUM ( Sales[Amount] )LY Same Week Sales = VAR CurYW = SELECTEDVALUE ( 'Date'[Year-Week] ) VAR CurYear = VALUE ( LEFT ( CurYW, 4 ) ) VAR CurWeek = VALUE ( RIGHT ( CurYW, 2 ) ) RETURN CALCULATE ( [Total Sales], KEEPFILTERS ( FILTER ( ALL ( 'Date' ), 'Date'[ISO Year] = CurYear - 1 && 'Date'[ISO Week] = CurWeek ) ) )3. Visual
- Put a Slicer on Date[Year-Week] (single select).
- Add a Clustered column chart with:
- X-axis >> Year-Week
- Values >> Total Sales and LY Same Week Sales
Now when you select e.g. 2025-34 in the slicer, you’ll see two bars side-by-side:
- Current Year (2025-34) sales
- Last Year (2024-34) sales
4. Optional polish
- Rename measures to “Current Year” and “Last Year” for a cleaner legend.
- Add a dynamic title:
Chart Title = "Year-Week: " & SELECTEDVALUE('Date'[Year-Week]) & " - Current vs Last Year"- Kundan_RRFrequent Visitor
Hi Rohit,
Thanks for your answer, but it didn't resolve the problem.
- Kundan_RRFrequent Visitor
I want my visual like this
- SundarRajSuper User
Can you share the dataset you're working with?
Thanks- Kundan_RRFrequent Visitor
Hi SundarRaj, please find the sample dataset.
Qualified (40%) 24079.65968 10-May-24 Qualified (40%) 9301.8 10-May-24 Qualified (40%) 46509 2-May-24 Qualified (40%) 2325.45 2-May-24 Qualified (40%) 10802.09032 2-May-24 Qualified (40%) 24079.65968 2-May-24 Qualified (40%) 9301.8 2-May-24 Active (100%) 19460.76581 10-May-24 Active (100%) 19460.76581 2-May-24 Active (100%) 19460.76581 25-Apr-24 Active (100%) 19460.76581 19-Apr-24 Active (100%) 19460.76581 12-Apr-24 Active (100%) 19460.76581 5-Apr-24 Active (100%) 19460.76581 28-Mar-24 Active (100%) 19460.76581 22-Mar-24 Active (100%) 19460.76581 15-Mar-24 Active (100%) 19460.76581 8-Mar-24 Active (100%) 19460.76581 1-Mar-24 Active (100%) 19460.76581 23-Feb-24 Active (100%) 19460.76581 16-Feb-24 Active (100%) 19460.76581 9-Feb-24 Active (100%) 19460.76581 2-Feb-24 Active (100%) 19460.76581 26-Jan-24 Active (100%) 19460.76581 19-Jan-24 Active (100%) 19460.76581 12-Jan-24 Active (100%) 19460.76581 5-Jan-24 Active (100%) 1024.250832 22-Aug-25 Active (100%) 1024.250832 15-Aug-25 Active (100%) 1024.250832 8-Aug-25 Active (100%) 1024.250832 1-Aug-25 Active (100%) 1024.250832 25-Jul-25 Active (100%) 1024.250832 18-Jul-25 Active (100%) 1024.250832 4-Jul-25 Active (100%) 1024.250832 27-Jun-25 Active (100%) 1024.250832 20-Jun-25 Active (100%) 1024.250832 13-Jun-25 Active (100%) 1024.250832 6-Jun-25 Active (100%) 1024.250832 30-May-25 Active (100%) 1024.250832 23-May-25 Active (100%) 1024.250832 16-May-25 Qualified (40%) 24079.65968 10-May-24 Qualified (40%) 9301.8 10-May-24 Qualified (40%) 46509 2-May-24 Qualified (40%) 2325.45 2-May-24 Qualified (40%) 10802.09032 2-May-24 Qualified (40%) 24079.65968 2-May-24 Qualified (40%) 9301.8 2-May-24 Active (100%) 1024.250832 21-Mar-25 Active (100%) 1024.250832 14-Mar-25 Active (100%) 1024.250832 7-Mar-25 Active (100%) 1024.250832 27-Feb-25 Active (100%) 1024.250832 21-Feb-25 Active (100%) 1024.250832 14-Feb-25 Active (100%) 1024.250832 7-Feb-25 Active (100%) 1024.250832 31-Jan-25 Active (100%) 1024.250832 24-Jan-25 Qualified (40%) 24079.65968 10-May-24 Qualified (40%) 9301.8 10-May-24 Qualified (40%) 46509 2-May-24 Qualified (40%) 2325.45 2-May-24 Qualified (40%) 10802.09032 2-May-24 Qualified (40%) 24079.65968 2-May-24 Qualified (40%) 9301.8 2-May-24
- v-dineshyaCommunity Support
Hi Kundan_RR ,
Thank you for reaching out to the Microsoft Community Forum.
Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot). Do not include sensitive information. Do not include anything that is unrelated to the issue or question. Please show the expected outcome based on the sample data you provided.
Regards,
Dinesh
- Kundan_RFrequent Visitor
Hi v-dineshya ,
I provided the sample dataset, please provide the solution.- v-dineshyaCommunity Support
Hi Kundan_RR ,
I have replicated the scenario, It is not possible to generate the expected output visual which was provided by you. Please refer below PBIX file.
Regards,
Dinesh
- danextianSuper User
Do you want to show 2025-34 and 2024-34 as the legend and not just current/previous year?