I need to have the below line chart:
Purpose of visual: show a trend for the last 52 week up to date of trade this year, trade last year and weekly target (only available for 2020)
with the following conditions:
- x-axis will always show 52 weeks back from latest week with trade. E.g. if we're in week 44 2020, the chart should show from week 44 2019 to week 44 2020, when we move to week 45 the chart moves 1 week further week 45 2019 to week 45 2020.
- it should ignore the fact we have target and trade ly values for the whole year and focus on the latest week for which we have trade
- If you select the previous year, in this case 2019, it will simply show you full 2019.
In my date table I have the following fields available:
|date||date||01 April 2001|
|week_description||text||Week (10) of 2001-04-1|
|quarter_description||text||1st Quarter 2001-2001 (Q1)|
|half_description||text||1st Half 2001-2001 (SS)|
as you can see the majority are whole numbers because I need to use fiscal dates. E.g. Fiscal year 2020 starts on 20200302.
I came accross the following post: https://community.powerbi.com/t5/Desktop/Rolling-52-week-sales-and-preceding-52-week-sales/td-p/7201... but I can't seem to make it work.
I am facing exactly same situation for the past one month. However I couldn't figure out the solution.
if anybody has got solution to this issue. Please reply me back as soon as you can. It would be a great help.
Thanks & Regards
According to your description, I guess you want to get a line chart that displays the latest 52 weeks based on trade this year, I suggest you to use the relative date range slicer, which can get the result easily, you can take a look at my steps and find if it’s useful:
This is part of my test data(date range from 2017 to 2020):
Week number = YEAR([Date])&"-W"&WEEKNUM([Date])
And I can get what you want.
You can download my test pbix file here
If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.
Community Support Team _Robert Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I don't think this works because I need to use fiscal dates which are not "Date" variables. hence I cannot use relative date.
@sgaydarska , the best is to use a relative date slicer. https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range
Or have column like this in your date table
Week Type =
var _date =Today() //or //max(Table[Date]) //max date of table
var _eow = _date+ 7-1*WEEKDAY(_date,2)
[start week]<=_eow && [end date]>=_eow -7*45,"45 Weeks " ,
And filter 45 Weeks
Or refer this video :https://www.youtube.com/watch?v=duMSovyosXE
I don't think this works because I need to use fiscal dates which are not "Date" variables. hence I cannot use relative date. The fiscal part is what I'm struggling with.
Get a sneak peek into this year's Power Platform Conference Keynote.
Take a look at the September 2023 Power BI update to learn more.
Join Microsoft Reactor and learn from developers.
Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!