Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi, stuck with the following;
I have two YTD charts on the same page displaying the same measure that spits out a count value on a weekly axis. The first chart shows the selected year via a slicer but the other needs to show for the year previous to whatever is selected.
I've tried doing this by making two seperate measures and minuplating the dates based on the slicer selection but this won't work for various reasons. My other solution which isn't working is to try and add something to the filter, like a switch of 1 or0...1 being the year I want and 0 being the years to not show but I can't figure this out and get it working.
I thought I could create a calculated column in my date table that would give a 1 or 0 based on the selected slicer? I.e.
PY =
Var _Selected = SelectedValue(Slicer) //2023 for example
Var _PY = _Selected - 1
RETURN
If('date'[year] = _PY,1,0)
This just returns 1 for every row 😞
Any ideas?
Thanks,
Ben
Solved! Go to Solution.
If your primary measure is [Count], you could use the SAMEPERIODLASTYEAR function to return last year's data:
Count Last Year =
CALCULATE ( [Count], SAMEPERIODLASTYEAR ( DimDate[Date] ) )
Proud to be a Super User!
If your primary measure is [Count], you could use the SAMEPERIODLASTYEAR function to return last year's data:
Count Last Year =
CALCULATE ( [Count], SAMEPERIODLASTYEAR ( DimDate[Date] ) )
Proud to be a Super User!
Ah amazing, didn't know of that function.
Thanks
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
88 | |
86 | |
82 | |
66 | |
49 |
User | Count |
---|---|
138 | |
110 | |
104 | |
66 | |
64 |