Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
TJ712
Frequent Visitor

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 NumbGroupText
1SexFirst text summary
2Race/ethnicitySecond text summary
7StateLast 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

PieFilter = IF(ISFILTERED('Prevalence Data'[Demographics (groups)]),BLANK(),50)
in this case I hid the chart if no filter was selected- so I figured there might be a way to modify the "Blank" portion of that code to get it do what I want, but I haven't been able to figure out the exact structure.
 
I've also been trying to play around with the sorting of the variable.  I thought if the Text field was 'sorted by' "Group Numb" in my data file - it would treat the State group as the "Last Text" field and I could just select that option, but that doesn't seem to work.  It still wants to alphabetize the text field, and if nothing is filtered it will show me whatever text description is last alphabetically ( in this case the  one for race/ethnicity)
 
Is there a way around these issues?  Alternatively, I could eventually just modify my text descriptions so that the one for the state total does some last alphabetically, but there should be a better way.
 
Thanks
 

 

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
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

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yulgu-msft
Employee
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

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

That works.  Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.