Sunday, 4 September 2016

Dynamic Text in Power BI Card Visuals



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:

  1. Create a 'New Measure' by right clicking on needed fact or dimension on the right pan. I have create mesaure in DimSalesTerriorty. 
  2. Write this expression in the Measure

    Measure = "Country Name : " & IF(DISTINCTCOUNT(DimSalesTerritory[SalesTerritoryCountry]) > 1,"All Selected", FIRSTNONBLANK(DimSalesTerritory[SalesTerritoryCountry], ""))
  3. And you are done. Just select the 'Card' visual and select this newly created visual. 

Happy Coding!



No comments:

Post a Comment