Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
waleed111
Helper V
Helper V

Table and column

Column = SELECTCOLUMNS('List View', "inventory", 'List View'[Date-Time of Entry in Inventory])
when i use the above formula as column it give me this error:
A table of multiple values was supplied where a single value was expected.
but when use it as table
table = SELECTCOLUMNS('List View', "inventory", 'List View'[Date-Time of Entry in Inventory])
it work wethout problem, what is the reason?
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@waleed111 , Because selectcolumns return table. And when you create a new column it expects a new column value only one unique value. So new table it works and New columns it gives an error

https://docs.microsoft.com/en-us/dax/selectcolumns-function-dax

https://www.youtube.com/watch?v=TtkdZ2jbffA

 

New table is working because it expects a table

table = SELECTCOLUMNS('List View', "inventory", 'List View'[Date-Time of Entry in Inventory])

 

This function can now return a new column

Column = maxx(SELECTCOLUMNS('List View', "inventory", 'List View'[Date-Time of Entry in Inventory]),[Date-Time of Entry in Inventory])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
Super User

@waleed111 - There are three primary kinds of things that you can create in Power BI

  1. Column
  2. Measure
  3. Table

Columns and Measures formulas need to return single value (a scalar) while tables formulas need to return a table of values. When you are having problems with DAX formulas like this, it is always good to check the documentation:

https://docs.microsoft.com/en-us/dax/selectcolumns-function-dax

Here you can see:

Return value

A table with the same number of rows as the table specified as the first argument. The returned table has one column for each pair of <name>, <scalar_expression> arguments, and each expression is evaluated in the context of a row from the specified <table> argument.

 

Therefore, for the column formula, you will need to aggregate the table or perform some calculation that returns a scalar value, like wrapping that statement with a COUNTROWS function or one of the X iterators like SUMX, AVERAGEX, etc.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
amitchandak
Super User
Super User

@waleed111 , Because selectcolumns return table. And when you create a new column it expects a new column value only one unique value. So new table it works and New columns it gives an error

https://docs.microsoft.com/en-us/dax/selectcolumns-function-dax

https://www.youtube.com/watch?v=TtkdZ2jbffA

 

New table is working because it expects a table

table = SELECTCOLUMNS('List View', "inventory", 'List View'[Date-Time of Entry in Inventory])

 

This function can now return a new column

Column = maxx(SELECTCOLUMNS('List View', "inventory", 'List View'[Date-Time of Entry in Inventory]),[Date-Time of Entry in Inventory])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.