ISSELECTEDMEASURE

ISSELECTEDMEASURE

How to Use the Power BI DAX function ISSELECTEDMEASURE

Understanding the ISSELECTEDMEASURE Function

The ISSELECTEDMEASURE function in Power BI is used to determine whether a particular measure is selected in the pivot table or not. This function returns a Boolean value – TRUE if the measure is selected, and FALSE if it is not. The syntax for the ISSELECTEDMEASURE function is as follows:


ISSELECTEDMEASURE ( ❰measure❱ )


Here, ❰measure❱ is the name of the measure that you want to test.

How to Use ISSELECTEDMEASURE in Power BI

To use the ISSELECTEDMEASURE function in Power BI, you need to follow the steps below:

1. Open your Power BI report and go to the page where you want to use the ISSELECTEDMEASURE function.

2. Click on the Visualizations pane on the right-hand side of the screen and select the visual that you want to work with.

3. Go to the Values field in the visual and select the measure that you want to test.

4. Create a new measure and enter the following formula:


❰new measure name❱ = IF(ISSELECTEDMEASURE(❰measure name❱), ❰value if TRUE❱, ❰value if FALSE❱)


Here, ❰new measure name❱ is the name of the new measure that you want to create, ❰measure name❱ is the name of the measure that you want to test, ❰value if TRUE❱ is the value that you want to return if the measure is selected, and ❰value if FALSE❱ is the value that you want to return if the measure is not selected.

5. Click on the check mark to apply the changes.

Examples of Using ISSELECTEDMEASURE

Let's look at a few examples of using the ISSELECTEDMEASURE function in Power BI.

Example 1: Highlight the Selected Measure

Suppose you have a pivot table that shows sales data for different products. You want to highlight the selected measure in the table. Here's how you can do it:

1. Follow the steps mentioned above to create a new measure.

2. Enter the following formula:


Highlight Measure = IF(ISSELECTEDMEASURE(Sales), Sales, BLANK())


Here, we're testing whether the Sales measure is selected or not. If it is selected, we return the Sales value; otherwise, we return BLANK().

3. Drag the new Highlight Measure onto the Color saturation field in the visual.

This will highlight the selected measure in the pivot table.

Example 2: Show a Text Box if Measure is Selected

Suppose you want to show a text box in your report if a particular measure is selected. Here's how you can do it:

1. Follow the steps mentioned above to create a new measure.

2. Enter the following formula:


Show Text Box = IF(ISSELECTEDMEASURE(Sales), “Sales measure is selected”, “”)


Here, we're testing whether the Sales measure is selected or not. If it is selected, we return the text "Sales measure is selected"; otherwise, we return an empty string.

3. Drag the new Show Text Box measure onto a Card visual.

This will show the text box in your report if the Sales measure is selected.

The ISSELECTEDMEASURE function is a powerful tool in the DAX language that allows you to test whether a measure is selected in a pivot table or not. Using this function, you can create dynamic reports that respond to user selections. In this article, we looked at how to use the ISSELECTEDMEASURE function in Power BI and gave a few examples of its usage. With this knowledge, you can take your Power BI reports to the next level.

Power BI DAX Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

Subject

Your Name (required)

Company/Organisation

Email (required)

Telephone

Training Course(s)

Your Message

Upload Example Document(s) (Zip multiple files)

Copyright, G Com Solutions Ltd, 2024.
Tower Bridge Business Centre, 46-48 East Smithfield, London E1W 1AW
0800 998 9248   |   9:00 a.m. till 5:30 p.m.

Connect With Me: