Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello Guys,
I am trying to calculate Year over Year sales with Year as a slicer. I am able to achieve it when I have consecutive years but when I try to filter on year slicers with gap then it gives me incorrect result.
Below is the data I want to achieve when Year slicer is selected as 2016,2018. 1st table gives me correct output when no filter is applied on the Year slicer, but when the slicer is filtered on Year 2016 and 2018, I need to display the output in table 2. Please help.
Year | Current Year Sales | Prior Year Sales |
2016 | 1000 | 0 |
2017 | 2000 | 1000 |
2018 | 3500 | 2000 |
Expected output for prior sales | ||
Year | Current Year Sales | Prior Year Sales |
2016 | 1000 | 0 |
2018 | 3500 | 1000 |
Thank you
Tried to do multiple ways but if the year slicers is not selected consecutive years then the dateadd, sameperiodlast year functions are not working. Any help is really appreciated.
Below is the DAX which I am working on.
You need your filter to pick up the multiple months from the slicer. I found this solution in another post.
I guess if you replace your estimation measure
EstimateCurrentMonth = calculate(sum('Sales'[Estimate]);FILTER(ALL('Sales'[MonthNumber]);[MonthNumber] = 'MonthParameter'[MonthParValue]))
with this
EstimateCurrentMonth = var selectedMonths = Values('MonthParameter'[MonthParValue]) return calculate( sum('Sales'[Estimate]) ;FILTER( ALL('Sales'[MonthNumber]) ;[MonthNumber] IN selectedMonths ) )
Help when you know. Ask when you don't!
I should have said, you need to pick up multiple years from the slicer
the code examples show the pattern for doing that, but you have to change the table/column names
Help when you know. Ask when you don't!
Yes, but this gives me only current month and current year, I don't get the prior year for the selected year 2016, 2018.
@kentyler wrote:I should have said, you need to pick up multiple years from the slicer
the code examples show the pattern for doing that, but you have to change the table/column names
@kentyler thank you for responding but this doesn't give me Prior year when I select different years.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
46 | |
28 | |
22 | |
12 | |
8 |
User | Count |
---|---|
75 | |
53 | |
46 | |
15 | |
12 |