How to Display Selected Value from the Slicer in the?Card?
Addend Analytics: Microsoft D365 & Data Analytics Partner
100+ D365 Business Central & Power BI Implementations across U.S. | Europe | India
Are you tired of static text in your Power BI cards? Want to dynamically display values based on slicer selections? Let's dive into a simple yet powerful solution!
Problem: We often need to show selected values from slicers alongside static text in a card visual. For example, displaying "Year is: 2022" when "2022" is selected in the year slicer.
Solution:
Selected_val =
VAR Cond =
IF (
HASONEVALUE ( ‘Date Table'[Year] ),
SELECTEDVALUE ( ‘Date Table'[Year] ),
“”
)
RETURN
CONCATENATE ( “Year is : “, Cond )
Add a Card Visual: Drag and drop the newly created measure onto a card visual.
Result: The card will dynamically display the selected year, updating as the slicer selection changes.
Conclusion: By leveraging DAX and card visuals, you can create dynamic and informative visualizations in Power BI. This technique can be applied to various scenarios, making your reports more interactive and user-friendly.