Forum Discussion
Why does VALUES(Sales[Channel]) function returns an error in a table visual?
- 8 months ago
Hi frost789
When you use VALUES(Sales[Channel]) inside a measure, the result is not a single value.
VALUES returns a table object (a one-column table of distinct values), and a table cannot be placed directly in a visual that expects a single scalar value.
That’s why you get an error when dragging the measure into a table visual.A measure must always return one value, not a column.
If your goal is to display a list of the distinct channels inside one cell of the visual, wrap VALUES with CONCATENATEX, for example:
Channels =
CONCATENATEX( VALUES(Sales[Channel]), Sales[Channel], ", " )
This returns a text string, which can be shown in any visual.If your intention is to create a physical column or a table containing the unique channels, then VALUES must be used in a calculated table, such as:
ChannelsTable =
VALUES(Sales[Channel])
This creates a proper table object that Power BI can display.Yes — this is the correct technical reasoning:
• VALUES returns a table, not a scalar
• Measures cannot return tables
• CONCATENATEX converts the table into a usable single value
• For physical modeling, use a calculated table insteadThe upfated pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Hi frost789
When you use VALUES(Sales[Channel]) inside a measure, the result is not a single value.
VALUES returns a table object (a one-column table of distinct values), and a table cannot be placed directly in a visual that expects a single scalar value.
That’s why you get an error when dragging the measure into a table visual.
A measure must always return one value, not a column.
If your goal is to display a list of the distinct channels inside one cell of the visual, wrap VALUES with CONCATENATEX, for example:
Channels =
CONCATENATEX( VALUES(Sales[Channel]), Sales[Channel], ", " )
This returns a text string, which can be shown in any visual.
If your intention is to create a physical column or a table containing the unique channels, then VALUES must be used in a calculated table, such as:
ChannelsTable =
VALUES(Sales[Channel])
This creates a proper table object that Power BI can display.
Yes — this is the correct technical reasoning:
• VALUES returns a table, not a scalar
• Measures cannot return tables
• CONCATENATEX converts the table into a usable single value
• For physical modeling, use a calculated table instead
The upfated pbix is attached
If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly
Thank you for your answer! How does one upload files as you did? I had to resort to uploading onto Limewire, but those files only stay hosted for a few days, then they disappear, just like what happened here.