Forum Discussion
DAX - Simple Table FILTER not working with SELECTEDVALUE
- 4 years ago
My colleague found a good solution to this problem. It's definitely a work-around but it's better than the workaround I was using.
Measure Code:
SelectedEmail = IF(HASONEFILTER('Upgrade Details'[Email]), 1, BLANK())Then the Measure is added to the very end of the table, renamed to "_" (so it takes up minimal space) and the column is reduced so it can't be seen. The other columns have to be set to not aggregate. Now, the table on the right will only show data if a single email value is selected on the left. 😁
A calculated table cannot be responsive to filters.
Calculated tables and calculated columns are only calculated once per time the data model is loaded or refreshed and not in response to interaction with various slicers or filters on a report page.
Measures, on the other hand, are designed to be dynamically responsive to interactions and there's usually a way to use them to do what you ultimately intended to use a calculated table for.
Okay, thanks. I didn't realize these didn't refresh based on filter context.
But this can't exist as a measure right? I'll get a scalar value warning because I'm returning multiple columns. I want the filtered table... I'm not sure how that can be represented in a measure.
- AlexisOlson4 years ago
Super User
You don't necessarily even need measures for this simple case since visuals can cross-filter each other and you can create slicers.
As an example, try selecting Black in your bottom matrix visual and see what it does to the table visual above.
- pelowski4 years ago
Helper III
Yeah, but if I don't want anything to show in the table (because it's not relevant until something is selected on the matrix) I have to do something like this which I've done but it comes with a lot of headaches like...
- It's hard to edit the report because there is a transparent card in the front of the table all the time.
- I have to allow users to see the scrollbar at all times otherwise they can't select it because the transparent card visual is in the foreground.
As I said, this is a really basic example. What I was hoping to do is take the data from the matrix visual, filter a table with one unique value (email address in the real world) and then pivot on something else entirely while joining in another table of values to calculate some totals. I've defaulted to doing it all in PowerQuery which I'm comfortable with, but I was hoping that more of it could be done on the DAX side so filter context could be maintained.
This is what I have...
Card in front of table that becomes transparent when email address is selected
- AlexisOlson4 years ago
Super User
I see. I can't think of a better solution at the moment.
A different approach would be to make a dropdown email slicer (that doesn't filter the left matrix) with a forced single selection. This has different drawbacks but might work in some similar situations.