Forum Discussion
DAX Table not responding to slicer values
I'm trying to create a table of filtered values that responds to a slicer selection. However, it doesn't seem to work... SELECTEDVALUE() is returning all rows in the table, even though I have a slicer selected.
PBIX link: https://1drv.ms/u/s!AhcctnI0qBnIjkh23Ov1Qm0-u1wq?e=AWvqJa
Hi Anonymous
the reason the number of periods does not change is that the table 'Periods to display' is a calculated table. Calculated tables does not respond to slicers, in the same way as calculated columns does not respond to slicers.
You can create a measure like this:
filterMeasure = VAR _type = CALCULATE ( SELECTEDVALUE ( 'CY & FY'[CY & FY] ) ) RETURN SWITCH ( TRUE (), _type = "CY" && COUNTROWS ( FILTER ( Periods, [Is In Current CY] = "Yes" ) ) >= 1, 1, _type = "FY" && COUNTROWS ( FILTER ( Periods, [Is In Current FY] = "Yes" ) ) >= 1, 1 )and use that to filter the visual showing the available months. I have updated your pbix-file, you find it attached below.
Cheers,
Sturla
If this post helps, then please consider Accepting it as the solution. Kudos are nice too.
5 Replies
- Greg_Deckler
Community Champion
Anonymous - That's because you have no relationship between your tables. In particular, between CY & FY table and your Periods and Periods To Display tables. That's sort of required for slicers to work betwen tables unless you form the relationship within a measure.
- AnonymousNot applicable
Greg Thank you for your response. The data I have doesn't seem to conceptually support a relationship between these tables. However, if I was to have a relationship, SELECTEDVALUE() would return the appropriate value? I was hoping that the use of a DAX table would eliminate the need to create a relationship
- Greg_Deckler
Community Champion
SELECTEDVALUE is working correctly, I can see that in your Card visualization. If I select CY, I see "It's a CY". If I select FY, I see "It's a FY". So that means SELECTEDVALUE is working just fine as expected.
Perhaps we should back-up and you should explain what you are trying to achieve.