- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PY column not responding to MTD/QTD/YTD slicer
I'm creating a Power BI dashboard using Zebra BI table visual with two columns: PY (Previous Year) and AC (Actuals). In my database "Baza 23," I have a column "Scenarij" that refers to either 2022 (Previous Year) or 2023 (Actuals).
I also have a calendar table and I have made a connection between the calendar table (date column) and "Baza 23" (date column).
I made two measures:
1: AC filter = CALCULATE(SUM('Baza 23'[EUR]), 'Baza 23'[Scenarij] = "2023")
2: PY filter = CALCULATE(SUM('Baza 23'[EUR]), 'Baza 23'[Scenarij] = "2022")
When I put these measures in the Zebra BI table, they work perfectly fine. However, I want to put an MTD/QTD/YTD slicer and connect it to these two columns so that when I choose a scenario in this slicer, the data in the PY column and AC column change accordingly. To achieve this, I created a "Selected Period" table with two columns: Period column and Period ID:
I added Selected period measure: Selected Period = MIN('Selected Period'[Period ID]). I was able to connect my columns to MTD/QTD/YTD slicer by using these two measures:
AC = SWITCH('Selected Period'[Selected Period],
1, CALCULATE([AC filter], DATESMTD('Calendar'[Date])),
2, CALCULATE([AC filter], DATESQTD('Calendar'[Date])),
3, CALCULATE([AC filter], DATESYTD('Calendar'[Date]))
PY = SWITCH('Selected Period'[Selected Period],
1, CALCULATE([PY filter], DATESMTD('Calendar'[Date])),
2, CALCULATE([PY filter], DATESQTD('Calendar'[Date])),
3, CALCULATE([PY filter], DATESYTD('Calendar'[Date])))
AC measure works perfectly fine, but when I use the PY measure and put it in the Zebra BI table, the column doesn't show any numbers. Why is that and how can I fix this problem?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Ema123 ,
@olgad gives some direction and reasons on your problem. (@olgad Thanks to for your efforts).
Please try to update the formula of below measures as below and check if they can return the expected result...
AC filter =
VAR _selyear =
SELECTEDVALUE ( 'Calendar'[Year] )
RETURN
CALCULATE ( SUM ( 'Baza 23'[EUR] ), 'Baza 23'[Scenarij] = _selyear )
PY filter =
VAR _selyear =
SELECTEDVALUE ( 'Calendar'[Year] )
RETURN
CALCULATE (
SUM ( 'Baza 23'[EUR] ),
FILTER ( 'Baza 23', 'Baza 23'[Scenarij] = _selyear - 1 ),
ALL ( 'Baza 23' )
)
If the above ones can't help you figure out, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, thank you for your respond. The only other slicer that I am using is "Month" slicer form 'Calendar'[Month]. Is there a way to write these measures in a way they are not hardcoded?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Ema123 ,
@olgad gives some direction and reasons on your problem. (@olgad Thanks to for your efforts).
Please try to update the formula of below measures as below and check if they can return the expected result...
AC filter =
VAR _selyear =
SELECTEDVALUE ( 'Calendar'[Year] )
RETURN
CALCULATE ( SUM ( 'Baza 23'[EUR] ), 'Baza 23'[Scenarij] = _selyear )
PY filter =
VAR _selyear =
SELECTEDVALUE ( 'Calendar'[Year] )
RETURN
CALCULATE (
SUM ( 'Baza 23'[EUR] ),
FILTER ( 'Baza 23', 'Baza 23'[Scenarij] = _selyear - 1 ),
ALL ( 'Baza 23' )
)
If the above ones can't help you figure out, please provide some raw data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following link to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, on the page itself, are you selecting any years from the calendar slicer/filter?
You have hardcoded years in your measures, so it might happen some other filters prevent you from seeing the numbers. Can you please give more info?
DID I ANSWER YOUR QUESTION? PLEASE MARK MY POST AS A SOLUTION! APPRECIATE YOUR KUDO/LIKE!
PROUD TO BE A SUPER USER!
Best Stories, Interesting Cases: PowerBI Storytime Newsletter
Linkedin Profile: Linkedin
YouTube Channel: PowerBI Storytime

Helpful resources
Subject | Author | Posted | |
---|---|---|---|
Anonymous
| 07-14-2021 04:49 AM | ||
05-17-2021 08:09 AM | |||
08-12-2019 02:37 AM | |||
02-04-2020 05:20 PM | |||
10-19-2022 02:04 PM |