Forum Discussion
How to create a measure that returns specific values from a column?
Hi Anonymous
Go the Modeling tab, then click 'New table'. You'll then need to enter a DAX expression for new table.
Your expression could be something like this:
NewTable =
FILTER(
ALL( Table1[ColumnA] ),
Table1[ColumnA] IN VALUES( Table2[ColumnB] )
)
This new table would contain a single column containing the values from ColumnA in Table1 that also exisit in ColumnB in Table2.
You can then use the new column as a slicer in your report.
Note: since there are no relationships to the new table, your measures will need to reference the new column (probably using TREATAS, VALUES or SELECTEDVALUE) so the slicer selction can be taken into account.
There are plenty of resources available about how to use disconnected slicers. Here are a few:
- powerpivotpro.com/2018/05/disconnected-slicers-with-dax-variables-selectedvalues/
- www.kasperonbi.com/dynamic-data-comparisons-using-disconnected-slicers-treatas-and-inactive-relationships/
Best regards,
Martyn
If I answered your question, please help others by accepting it as a solution.
- Anonymous6 years agoNot applicable
- MartynRamsden6 years ago
Solution Sage
Hi Anonymous
In that case, I think your only option is to speak to the developer of the Tabular data model and ask them to add your calculated column.
Best regards,
Martyn
If I answered your question, please help others by accepting it as a solution.
- Anonymous6 years agoNot applicableThank you for the reply MartynRamsden i will try to open the tabular project myself. But what did you mean by the previous note? That besides the calculated column ill be needing a key?
- MartynRamsden6 years ago
Solution Sage
Hi Anonymous
I wanted to stress that, if you added a disconnected slicer, you would probably have to update your measures to take its current value into account. Since you can't use a disconnected slicer, you don't need to worry about it.
Just thought of a solution which may work without you having to edit the model...
Create a measure to identify if a given value in Table1[ColumnA] is also in Table2[ColumnB]:
FilterColumnA = VAR SelColA = SELECTEDVALUE( Table1[ColumnA] ) VAR Result = IF ( SelColA IN VALUES ( Table2[ColumnB] ), "Y", "N" ) RETURN ResultAdd Table1[ColumnA] as a slicer on your report.
Then add the new measure as a visual level filter set and set it to "Y".
Your slicer will then only show values in ColumnA which also appear in ColumnB.
Best regards,
Martyn
If I answered your question, please help others by accepting it as a solution.- Anonymous6 years agoNot applicable
Thank you I will try that.