SELECTEDVALUE
A
C
- CALCULATE
- CALCULATETABLE
- CALENDAR
- CALENDARAUTO
- CEILING
- CHISQ.DIST
- CHISQ.DIST.RT
- CHISQ.INV
- CHISQ.INV.RT
- CLOSINGBALANCEMONTH
- CLOSINGBALANCEQUARTER
- CLOSINGBALANCEYEAR
- COALESCE
- COLUMNSTATISTICS
- COMBIN
- COMBINA
- COMBINEVALUES
- CONCATENATE
- CONCATENATEX
- CONFIDENCE.NORM
- CONFIDENCE.T
- CONTAINS
- CONTAINSROW
- CONTAINSSTRING
- CONTAINSSTRINGEXACT
- CONVERT
- COS
- COSH
- COT
- COTH
- COUNT
- COUNTA
- COUNTAX
- COUNTBLANK
- COUNTROWS
- COUNTX
- COUPDAYBS
- COUPDAYS
- COUPDAYSNC
- COUPNCD
- COUPNUM
- COUPPCD
- CROSSFILTER
- CROSSJOIN
- CUMIPMT
- CUMPRINC
- CURRENCY
- CURRENTGROUP
- CUSTOMDATA
D
E
I
N
O
P
R
S
- SAMEPERIODLASTYEAR
- SAMPLE
- SEARCH
- SECOND
- SELECTCOLUMNS
- SELECTEDMEASURE
- SELECTEDMEASUREFORMATSTRING
- SELECTEDMEASURENAME
- SELECTEDVALUE
- SIGN
- SIN
- SINH
- SLN
- SQRT
- SQRTPI
- STARTOFMONTH
- STARTOFQUARTER
- STARTOFYEAR
- STDEVX.P
- STDEVX.S
- STDEV.P
- STDEV.S
- SUBSTITUTE
- SUBSTITUTEWITHINDEX
- SUM
- SUMMARIZE
- SUMMARIZECOLUMNS
- SUMX
- SWITCH
- SYD
T
U
What is the SELECTEDVALUE Function?
The SELECTEDVALUE function is a DAX function that returns the value of a column for a single row in a table, or the value of a measure evaluated in the context of a single cell in a matrix or pivot table.
The function takes two arguments: the first argument is the name of the column or measure to be evaluated, and the second argument is the default value to be returned if there is no valid selection.
How to Use the SELECTEDVALUE Function
To use the SELECTEDVALUE function, follow these steps:
1. Open Power BI Desktop and create a new report.
2. Import the data you want to use in your visualization.
3. Add a slicer or a filter to your report.
4. Add a visual to your report that you want to filter based on the slicer or filter.
5. Click on the visual to select it.
6. In the Visualizations pane, go to the Filters section and click on the ellipsis (…) next to the field you want to filter by.
7. In the dropdown menu, select “Add Filter”.
8. In the Filter dialog box, select “Advanced filtering”.
9. In the Advanced filtering dialog box, select “SELECTEDVALUE” in the “Filter type” dropdown menu.
10. In the “Values” field, enter the name of the column or measure you want to filter by.
11. In the “Default value” field, enter the default value to be returned if there is no valid selection.
12. Click “OK” to apply the filter.
Example
Let’s say you have a data table with three columns: “Product”, “Region”, and “Sales”. You want to create a visualization that shows the total sales for a single product, based on a slicer that allows the user to select a region.
To achieve this, follow these steps:
1. Create a new report in Power BI Desktop.
2. Import the data table into your report.
3. Create a slicer based on the “Region” column.
4. Create a visual that shows the total sales for the selected product.
5. Select the visual and go to the Visualizations pane.
6. In the Filters section, click on the ellipsis (…) next to the “Product” field.
7. Select “Add Filter” from the dropdown menu.
8. In the Filter dialog box, select “Advanced filtering”.
9. In the Advanced filtering dialog box, select “SELECTEDVALUE” in the “Filter type” dropdown menu.
10. In the “Values” field, enter “Product”.
11. In the “Default value” field, enter “No product selected”.
12. Click “OK” to apply the filter.
Now, when the user selects a region in the slicer, the visual will show the total sales for the selected product in that region. If no product is selected, the default value “No product selected” will be displayed.
The SELECTEDVALUE function is a powerful tool for filtering your Power BI visualizations based on a single value from a slicer or a filter. By following the steps outlined in this article, you can start using this function in your own reports and take advantage of its many benefits.