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 all,
I'm trying to build a prior year DAX function that interactively works with a timeframe filter.
I have a timeframe table that assigns a 1 for a date ID that falls under "Current Week," "Current Month," "YTD," etc. I also have a -1 in the table to indicate the Current Week in the prior year, but I have these filtered out because the slicer would pull in both CY and PY if not.
I have a DAX formula for volume that interacts perfectly with the timeframe filter:
Solved! Go to Solution.
Hi @jludwick ,
If your data table is like this:
You can follow these steps:
1. Create a new table with all the options you need in the slicer.
2. Turn the single select of the slicer on
3. Then create a measure that calculate the Volume
calculate volumn =
SWITCH (
MAX ( 'for slicer'[Value] ),
"Prior Year",
CALCULATE (
SUM ( 'Invoice Details'[Volume_Qty] ),
FILTER ( 'Invoice Details', [Column] = -1 )
),
CALCULATE (
SUM ( 'Invoice Details'[Volume_Qty] ),
FILTER ( 'Invoice Details', [Column] = 1 )
)
)
Final output:
If not, please provide me with more details about your table and your expected output or share me with your pbix file after removing sensitive data.
Refer to:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @jludwick ,
If your data table is like this:
You can follow these steps:
1. Create a new table with all the options you need in the slicer.
2. Turn the single select of the slicer on
3. Then create a measure that calculate the Volume
calculate volumn =
SWITCH (
MAX ( 'for slicer'[Value] ),
"Prior Year",
CALCULATE (
SUM ( 'Invoice Details'[Volume_Qty] ),
FILTER ( 'Invoice Details', [Column] = -1 )
),
CALCULATE (
SUM ( 'Invoice Details'[Volume_Qty] ),
FILTER ( 'Invoice Details', [Column] = 1 )
)
)
Final output:
If not, please provide me with more details about your table and your expected output or share me with your pbix file after removing sensitive data.
Refer to:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
With calendar table you can use
Solved: Prior Year to Date Billable - Microsoft Power BI Community
Regards,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
23 | |
10 | |
10 | |
9 | |
7 |