There are situation when you want to display dynamic text in
Power BI based on the selection made on any of the visuals. This can be easily
achieved using ‘Card’ visual and DAX statement.
In the following sample I want to show the selected country
in the Visual and if no country is selected it should show as ‘All Selected’.
Steps:
- Create a 'New Measure' by right clicking on needed fact or dimension on the right pan. I have create mesaure in DimSalesTerriorty.
- Write this expression in the Measure
Measure = "Country Name : " & IF(DISTINCTCOUNT(DimSalesTerritory[SalesTerritoryCountry]) > 1,"All Selected", FIRSTNONBLANK(DimSalesTerritory[SalesTerritoryCountry], "")) - And you are done. Just select the 'Card' visual and select this newly created visual.
Happy Coding!