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.
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
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 |
---|---|
51 | |
27 | |
24 | |
13 | |
8 |
User | Count |
---|---|
74 | |
56 | |
47 | |
16 | |
12 |