Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hey All,
I have these 3 measures to calculate Selected Year Sales, Selected Year - 1 Sales, and Selected Year - 2 Sales:
Selected Year = CALCULATE(SUM(Data[Sales]), DATEADD(DimDate[Date], 0, YEAR)
Selected Year - 1 = CALCULATE(SUM(Data[Sales]), DATEADD(DimDate[Date], -1, YEAR)
Selected Year - 2 = CALCULATE(SUM(Data[Sales]), DATEADD(DimDate[Date], -2, YEAR)
These are then put into a stacked bar chart with Vendor on the x axis and the three measures in the Values field.
The issue i'm having is that when i hover over the stacks, there's no way to find out which year i'm hovering over (unless you look at the legend). Reason for this is because the 'Legend' field cannot be populated since i'm bringing in 3 calculated measures.
How would i dynamically display the year i'm hovering over?
I tried some If and SWITCH statements but it returns the same year across all 3 stacks.
For more context, there is also a report level slicer and based on the financial year that is selected, the stacked bar chart should always show selected year as well as previous 2 years.
@Andrea_Jess ,Two ways I can think of. One is calculation group.
Another one, Create a 3 year measure based on selected year and independent table and use year as legend
//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = year(maxx(allselected(Date1),Date1[Date]))
var _min = _max -2
return
calculate( sum(Table[Value]), filter('Date', 'Date'[year] >=_min && 'Date'[year] <=_max))
Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI