Forum Discussion
Default text if not filtered
Hi all,
I am trying to create dynamic text descriptions below my chart that change based on what slicers are selected (or not selected), but I am running into a problem when there is no slicer selected.
My bar chart by default shows data for several demographic groups - e.g., male, female, white, black, hispanic. When nothing is filtered all the demographic groups will show. If the user only wants to see data for males and females they can select "sex" from the slicer and all the other demographic groups will be removed from the chart. I wanted to have text summaries below the chart that change based on the slicer selections; e.g., if they select "sex" - only the male/female values will show on the chart and the text below will describe the findings relevant to male or female. I was using the "Text Enhancer" from the marketplace to do this. This works well, but the problem occurs when nothing is selected in the filter. What I want is for the text corresponding to the "state" group in my table below to show, but instead if no filter is selected I can seemingly only choose to display the "first" or "last" text field, or a non-summarized version that shows all the rows of text.
Here's a mockup of the general idea of the text table.
| Group Numb | Group | Text |
| 1 | Sex | First text summary |
| 2 | Race/ethnicity | Second text summary |
| 7 | State | Last text summary |
What I want is basically to say if the data are not filtered by group then use the description for the full state data - ('last text summary' in the chart).
I've done something like this before to get around the default outcome
Hi TJ712 ,
Please try this measure:
PieFilter = IF(ISFILTERED('Prevalence Data'[Demographics (groups)]),SELECTEDVALUE('Prevalence Data'[Text]),CALCULATED(SELECTEDVALUE('Prevalence Data'[Text]),FILTER(ALLSELECTED('Prevalence Data'),'Prevalence Data'[Demographics (groups)]="State")))Best regards,
Yuliana Gu
2 Replies
- v-yulgu-msft
Microsoft Employee
Hi TJ712 ,
Please try this measure:
PieFilter = IF(ISFILTERED('Prevalence Data'[Demographics (groups)]),SELECTEDVALUE('Prevalence Data'[Text]),CALCULATED(SELECTEDVALUE('Prevalence Data'[Text]),FILTER(ALLSELECTED('Prevalence Data'),'Prevalence Data'[Demographics (groups)]="State")))Best regards,
Yuliana Gu
- TJ712Frequent Visitor
That works. Thanks!