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.
Not sure what's going on with this. For context, I have a filter on a date reference table limiting the data to 2020, 2021, 2022 data. Within the matrix, if I use the below Switch statement (which simply grabs a measure based on a slicer) the filtered years appear in the matrix. If I swap out the switch measure for the measure it's grabbing ([Sum Net Rev Attrib]) I get the desired result where the filtered years do not display. Both measures within the switch statements are standard SUM ( some column ), nothing fancy. The only change is one the measure is directly placed in the matrix values and produces the desired result but, when the same measure is being called coming through SWITCH TRUE the filter does not apply to the matrix correctly any longer.
Any thoughts on how to use the switch logic and have the filtered years not display?
For consideration:
With Switch:
Without Switch:
Solved! Go to Solution.
Hey there, thanks for the reply. I believe I figured this out this morning. I'm actually using the new parameter feature for the columns but did not explain that. Normally I would take that approach however, I've run into issues with the new feature when trying to have other measures switch based on what parameter is selected.
This table is getting built out more with Prior Period and % change from prior period throughout the date hierarchy. Where I've run into issues and haven't seemed to figure out is how to setup my prior period measure to use the measure for whatever is currently selected within the parameter. So, for this example I have two options I could setup the parameter for (Attributed Revenue and Base Revenue). If I were just displaying those two values the parameter method would be easy. However, if I'm trying to calculate the prior period based on whichever item is selected within the parameter I haven't figured out a way to do that within DAX yet. I'm probably missing something obvious but I haven't been able to get it to work.
For this problem, the issue was actually using the default calendar hierarchy auto created by PowerBI. When I created a custom Hierarchy using the fields within my date reference table everything worked as intended with the different date filters using that switch statement.
Is the objective to enable dynamic measure selection (i.e. the ability to toggle between [SUM Net Rev Raw] and [Sum Net Rev Attrib])? If so, there's a simpler approach using the new feature Field Parameters:
https://docs.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters
Proud to be a Super User!
Hey there, thanks for the reply. I believe I figured this out this morning. I'm actually using the new parameter feature for the columns but did not explain that. Normally I would take that approach however, I've run into issues with the new feature when trying to have other measures switch based on what parameter is selected.
This table is getting built out more with Prior Period and % change from prior period throughout the date hierarchy. Where I've run into issues and haven't seemed to figure out is how to setup my prior period measure to use the measure for whatever is currently selected within the parameter. So, for this example I have two options I could setup the parameter for (Attributed Revenue and Base Revenue). If I were just displaying those two values the parameter method would be easy. However, if I'm trying to calculate the prior period based on whichever item is selected within the parameter I haven't figured out a way to do that within DAX yet. I'm probably missing something obvious but I haven't been able to get it to work.
For this problem, the issue was actually using the default calendar hierarchy auto created by PowerBI. When I created a custom Hierarchy using the fields within my date reference table everything worked as intended with the different date filters using that switch statement.
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 |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |