Forum Discussion
Create Drill Through table from SWITCH Measure
Hello,
I have begun using the Switch function in conjunction with Slicers to create some bar chart visuals. Given the following Measure:
MissingPunchCount_Unpivot_Switch = SWITCH(
TRUE(),
[Selected_MissingPunchPeriod] = "Yesterday", [MissingPunchCount_Unpivot_Yesterday],
[Selected_MissingPunchPeriod] = "Current Pay Period",
CALCULATE( [MissingPunchCount_Unpivot],
vw_RPT_MissedPunches_ALL__DALY[PayPeriod] = "Current" ),
[Selected_MissingPunchPeriod] = "Previous Pay Period",
CALCULATE( [MissingPunchCount_Unpivot],
vw_RPT_MissedPunches_ALL__DALY[PayPeriod] = "Previous" ))
In a Slicer, User can select from 3 time periods - Yesterday, Current Pay Period, and Previous Pay Period.
Example of bar chart for "Yesterday" follows where the blurred out y-axis is Facility:
This is all fine and good. Now I provide the User with a Drill Through button to navigate to a Details page containing a Table Visual at the Facility Level.
However, this table is capturing all Rows for the Facility , and does not consider the time period selected.
The issue I believe is the Drill Through does not recognize the various filters being used in my Switch Statement above.
Hoping someone can provide some assistance or guidance as to how best to filter the Drill Through table to capture only the relevant rows derived from the Switch Statement.
As always thanks in advance and kind regards,
4 Replies
- TheoCCommunity Champion
Hi rsbin
I think you may need to adjust the measure and consider variables. All the results I have seen that drill down to keep filters, etc., incorporate them.
A couple of them include:
- https://www.sqlbi.com/articles/optimizing-if-and-switch-expressions-using-variables/
- https://www.pbiusergroup.com/communities/community-home/digestviewer/viewthread?MessageKey=b52f0351-c430-43d2-8665-9bee835416c7&CommunityKey=3a98540b-3655-4795-b8cb-30dbeb93ba78&tab=digestviewer
Both incorporate SELECTEDVALUE as a variable which I believe is going to be a key component of getting what you want.
I was going to recreate your measure, however, I couldn't really get a full understanding of the table / field naming conventions, or of the existing measures.
Hope this helps 🙂
Theo