Forum Discussion
Need help with YOY line chart
Hello Community!
I'm very new to the Power BI and I need your help creating a year over yer comparision line chart.
At the moment I have created a line chart however for the PY it shows full year whereas I only want it to display same yearweek as current.
Another thing I need help with is creating a calculation field 'Change' which calculates the difference beween CY sales vs LY sales YTD (LY should only go upto max this years week. ). My data shows weekly and end of last week. I want the YTD total to display CY, and LY should be end of prior week LY(08/13/2022)
Below is how somewhat my data displays
Id really appreciate any help. Thank you!
Anonymous
you can create a scope column, then only do the calculation when scope is y
pls see the attachment below
13 Replies
- ryan_mayuSuper User
could you pls paste the sample data (not the screenshot) and also provide the expected output?
- AnonymousNot applicable
Site Year Week End YearWeek Name Amount CY vs PY 1 2022 5/7/2022 18 AAA 500 PY 2 2023 5/6/2023 18 BBB 100 CY 3 2022 5/7/2022 18 CCC 300 PY 3 2022 5/7/2022 18 EEE 350 PY 3 2022 5/7/2022 18 AAA 100 PY 2 2023 5/6/2023 18 BBB 500 CY 1 2022 5/7/2022 18 BBB 750 PY 1 2023 5/6/2023 18 AAA 600 CY 2 2022 5/7/2022 18 AAA 150 PY 1 2023 5/6/2023 18 EEE 35 CY 3 2022 5/7/2022 18 AAA 95 PY 1 2022 5/14/2022 19 EEE 160 PY 3 2023 5/13/2023 19 AAA 285 CY 2 2022 5/14/2022 19 EEE 125 PY 2 2023 5/13/2023 19 EEE 150 CY 2 2022 5/14/2022 19 CCC 200 PY 1 2023 5/13/2023 19 EEE 450 CY 1 2022 5/14/2022 19 CCC 365 PY 1 2022 5/14/2022 19 AAA 250 PY 2 2023 5/13/2023 19 BBB 950 CY 2 2022 5/14/2022 19 BBB 1000 PY 3 2023 5/6/2023 18 CCC 350 CY 2 2023 5/13/2023 19 CCC 625 CY Heres my sample data. I already have this dashboard on Tableau and I'm trying to recreate it on PowerBI. Below is a snip of what I'm trying to get
At the moment I have the line chart created however I'm unsure on how to create the red boxed section which displays current year total(YTD), PY total(YTD total as same yearweek as CY), Change in $ and change%.
- ryan_mayuSuper User
Anonymous
here is a wordaround for you
you just need to change the name filter to create the box for other names.
- AnonymousNot applicable
ryan_mayu Sorry for the late reply. This is exactly the format I was looking for. I need one additional thing changed and need your help with. My current data is looking YTD and ends last Sat. So for the current report, it should have data from 1/1/23 - 9/2/23. I want the PY to be compare the same time period(Week) so itd be 1/2/22 - 9/3/22 if that makes sense.
- AnonymousNot applicable
ryan_mayu Thank you again. This solved my problem.
- ryan_mayuSuper User
you are welcome