Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi there,
I have a matrix in power BI, items in rows, years in columns and a YOY% difference measure.
I can;t show actual data, so here is an example in excel of what I'm doing:
Problem is I'm not always comparing to previous year. Sometimes we may want to compare 2019 Vs 2022. This works in excel:
Excel calculates the difference in the filtered period. However when I do this in Power BI, when I filter it returns the previous year % difference not filtered period.
In power BI I am using a matrix like this:
Fruit YoY% (from quick measures) code is:
Which works for YoY, but when I filter, eg, 2020 Vs 2022, it still shows 2022 Vs 2021 % dif.
When I use the below code, it works when two filters are on, but defaults to 2019 Vs 2022:
Ideally, I'd need top level to be YoY%, (across all years if possible but 2022 Vs 2021 would be fine), then the slice the years to get the below:
So ideally it would be:
1. YoY% difference (2022 Vs 2021, 2021 Vs 2020 etc)
2. Slicer two years (eg 2022 Vs 2020)
3. Filtered years % difference eg 2022 Bs 2020)
4. Remove slicers to return back to YoY% difference (2022 Vs 2021, 2021 Vs 2020 etc)
Any help on what DAX I need to make this work would really help!
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |