Forum Discussion
Creating a dynamic text field in DAX
If I'm understanding your request correctly, you need:
Selected region = IF(ISFILTERED(Disconnected Table [Field]), SELECTEDVALUE(Disconnected Table [Field]), "All Areas"),
or if you prefer to show nothing change "All Areas" to BLANK()
Thanks. Let me be more clear. I have two tables, one is the disconnected table, Table A, with one column containing the four values "Project", "Continent", "Sub Region", and "Country". The other table, Table B, is as shown below.
I want to have a field in Table B that changes dynamically based on the selected value from Table A. For example if "Project" is selected in Table A, then the field in Table B would contain the values from the [Project] column.
- v-jingzhang4 years ago
Community Support
Hi Anonymous
To be dynamic, it should be a measure. The problem is that a measure should be aggregated and is expected to return only one value, so it is possible to return e.g. First or Last value in a field, or Count of a field. It cannot display multiple values at the same time.
Here is one example
Measure = SWITCH(SELECTEDVALUE('Table A'[Type]),"Project",MAX('Table B'[Project]),"Country",MAX('Table B'[Country]),"Continent",MAX('Table B'[Continent]),"Sub Region",MAX('Table B'[Sub Region]))Another example
Measure 2 = SWITCH(SELECTEDVALUE('Table A'[Type]),"Project",COUNT('Table B'[Project]),"Country",COUNT('Table B'[Country]),"Continent",COUNT('Table B'[Continent]),"Sub Region",COUNT('Table B'[Sub Region]))You can see that I use Max and Count to aggregate every field in the measure. You can try using Values() to get the values in a field but when you put it into a visual, it will display an error saying "A table of multiple values was supplied where a single value was expected." If you want to display all values, you can use CONCATENATEX to concatenate the values in a column. What do you hope to do after getting the values in a column?
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.