To get a unique list of values from a column in Power BI, use the VALUES function in a DAX expression to create a calculated table or a measure. The VALUES function returns a one-column table that contains the unique values from the specified column, including the blank row that Power BI adds to handle referential integrity violations. This is primarily used to create distinct lists for slicers, validation tables, or as a filter context within more complex calculations.
What You'll Need
- Power BI Desktop installed on your machine.
- A dataset already loaded into your Power BI model.
- A table containing at least one column with data you wish to deduplicate.
- Basic familiarity with the Modeling tab in the Power BI ribbon.
Step-by-Step
- Open Power BI Desktop and load your data source. Ensure that the table containing the column you want to extract values from is visible in the Data pane on the right side of the screen.
- Navigate to the Modeling Tab. Look at the top ribbon menu and click on the Modeling tab. From here, you will find the option to create new data structures.
- Select New Table. Click the New Table button. This will open the DAX formula bar at the top of the report canvas, allowing you to enter a formula to generate a calculated table based on your existing data.
- Enter the VALUES Formula. In the formula bar, type the following syntax:
UniqueList = VALUES('TableName'[ColumnName]). Replace 'TableName' with the actual name of your table and 'ColumnName' with the specific column you want to extract unique values from. For example, if you have a table named Sales and a column named ProductID, your formula would beProductList = VALUES(Sales[ProductID]). - Commit the Formula. Press Enter or click the checkmark icon next to the formula bar. Power BI will process the request and create a new table in your Data pane containing only the unique entries from that column.
- Verify the Results. Click on the newly created table in the Data pane and select the Table view (the grid icon on the left sidebar). You should now see a single-column table where every value appears only once.
- Apply the Table to a Visual. Go back to the Report view. Drag a Slicer visual onto the canvas and pull the column from your new VALUES table into the Field well. This ensures your slicer is driven by a clean, distinct list of values.
Common Mistakes
One of the most frequent errors is confusing the VALUES function with the DISTINCT function. While both return unique values, VALUES includes the "Unknown" or blank row if there is a referential integrity issue (e.g., a fact table contains a key that does not exist in the dimension table). If you absolutely do not want that blank row, you should use DISTINCT instead. Another common mistake is trying to use the VALUES function inside a calculated column to return a single value. Because VALUES returns a table, not a scalar value, using it in a calculated column will result in an error stating that a table of multiple values was supplied where a single value was expected. To fix this, you would need to wrap the VALUES function in another function like SELECTEDVALUE or MIN.
Users also often forget that calculated tables are only refreshed during a full data refresh. If you are expecting the VALUES table to change dynamically based on a slicer selection made by the end-user in a report, you are using the wrong tool. Calculated tables are computed at the model level during processing, not at the report level during interaction. To achieve a dynamic list that reacts to filters, you must use a measure or a visual filter rather than a calculated table.
Tips
To make your VALUES table more useful, consider sorting it. By default, the table will be sorted based on the data type (alphabetically for text, numerically for integers). If you want the unique list to be sorted by a different criteria, you can create a relationship between your new VALUES table and the original table in the Model view. Once the relationship is established, you can use the Sort by Column feature in the Column tools tab to organize your unique list according to a specific index or date.
For advanced users, the VALUES function is incredibly powerful when used inside a CALCULATE statement. By using VALUES as a filter argument, you can tell Power BI to perform a calculation for every unique value in a specific column, effectively ignoring other filters that might be interfering with that specific dimension. This is a key technique for creating "All-Selected" totals or comparing a specific item's performance against the average of all unique items in a category.
If you are dealing with very large datasets, be mindful of memory. Creating many calculated tables using VALUES can increase the size of your .pbix file because these tables are stored in the RAM. If you only need the unique list for a slicer, it is often more efficient to simply drag the original column into a slicer visual; Power BI automatically handles the deduplication for the visual without needing a separate physical table in the model.
Troubleshooting
If you encounter an error saying "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value," it means you are trying to use the VALUES function in a place that expects a single piece of data (like a Card visual or a Calculated Column) instead of a table. To resolve this, ensure you are using "New Table" to create the list, or wrap your formula in CALCULATE(SELECTEDVALUE('Table'[Column])) if you are creating a measure.
If the VALUES table is showing a blank row that you cannot explain, check your data relationships. This usually happens when a child table (Fact table) has a value in a foreign key column that does not exist in the parent table (Dimension table). Power BI adds this blank row to ensure that the data in the Fact table is still accounted for even if it doesn't have a matching category. To fix this, you must clean your source data to ensure all keys are valid or accept the blank row as a data quality indicator.
If the table does not update when your source data changes, ensure you have triggered a Refresh in the Home tab. Calculated tables are not updated in real-time as you type in the source; they require a model refresh to re-evaluate the DAX expression and pull the latest unique values from the source column.
Frequently Asked Questions
What is the difference between VALUES and DISTINCT?
VALUES includes the implicit blank row created by Power BI to handle referential integrity violations between tables. DISTINCT does not include this blank row; it only returns the actual unique values present in the column.
Can I use VALUES to create a dynamic list for a dropdown?
If you use VALUES in a "New Table," the list is static until the data is refreshed. If you need the list to change based on other slicers, you should use the original column in a slicer visual, which Power BI manages dynamically.
Does the VALUES function work on multiple columns at once?
No, the VALUES function takes a single column as an argument. If you need a unique combination of multiple columns, you should use the SUMMARIZE function instead.
Will using VALUES slow down my report?
For most datasets, no. However, creating dozens of calculated tables can increase memory usage. If you only need the unique list for a visual, it is better to use the column directly in the visual rather than creating a new table.
Can I use VALUES in a Measure?
Yes, but since a measure must return a single value (a scalar), you cannot simply put VALUES(Column). You must use it inside another function, such as COUNTROWS(VALUES('Table'[Column])) to count how many unique items exist in the current filter context.