Forum Discussion
Unable to use Parameter Dynamic Filter
Hi PeterNg ,
I can see you're having trouble implementing the calendar grouping logic across multiple reports on the same page in Power BI. Let me help troubleshoot your DAX formula for filtering based on the selected calendar grouping.
Looking at your code, I notice a few potential issues:
In your SWITCH statement, you're using asterisks (*) instead of underscores (_) in some variable references like "*str" instead of "_str"
The condition checking for all three options being selected (COUNTROWS(tmp) =3) doesn't specify what should happen in that case
Here's a corrected version of your DAX measure:
Reader Head Shipment =
VAR tmp =
SELECTCOLUMNS('Calendar Grouping', "PT", [Select Calendar Grouping])
VAR _str =
CONCATENATEX(tmp, [PT])
VAR _a =
SWITCH(
TRUE(),
COUNTROWS(tmp) = 3, 1,
CONTAINSSTRING(_str, "Quarter"), IF(SELECTEDVALUE(FISCAL_CALENDAR[FISCAL_QTR_REL]) >= -7, 1, 0),
CONTAINSSTRING(_str, "Month"), IF(SELECTEDVALUE(FISCAL_CALENDAR[FISCAL_MONTH_REL]) >= -11, 1, 0),
CONTAINSSTRING(_str, "Week"), IF(SELECTEDVALUE(FISCAL_CALENDAR[FISCAL_WEEK_REL]) >= -12, 1, 0),
0
)
RETURN _a
For the report where it's not working (with Rows2: Monitor Grouping and Columns2: Select Calendar Grouping), the issue might be related to filter context. When you have different fields in the rows, the filter context changes, which can affect how your measure evaluates.
Try these approaches:
Make sure your Calendar Grouping parameter is properly connected to both visuals
Consider using CALCULATE with ALLSELECTED to maintain proper filter context
Check if the field references in your second report match exactly with your first report
Would you be able to share what type of visuals you're using for both reports? That might help me give you more specific advice on fixing the issue.
🌟 I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
💡 Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
🎖 As a proud SuperUser and Microsoft Partner, we’re here to empower your data journey and the Power BI Community at large.
🔗 Curious to explore more? [Discover here].
Let’s keep building smarter solutions together!