Forum Discussion
Use of {0} in Power Query
Hi have a code that gives me following table-
1. Code - Just Amended the source for Pic, Ignore the error
Table
The thing is I do not want it as table but as a blank list as follows:
3 - The requirement
So I add 1 more step to my query in Pic 1 as follows and everything works:
4. Added Code highlighted in step 1(added code in line 3)
I am getting what I want and happy but I have no idea what the added code is doing and no idea what am I doing. Can someone please temm me what the third line of my code is doing Column1 = #"Term1End2021_DefinedName"{0}[Column1]
Your explanation will be highly appreciated.
Thank you
in your second step of #"Term1End2021_DefinedName", you get a table.
#"Term1End2021_DefinedName"{0} get the first row of the table, it's a record
#"Term1End2021_DefinedName"{0}[Column1] get the field of Column1 of the record
- Anonymous5 years ago
The first code returns type table--a table value that contains the value 44288 in [Column1]{0} which is Column1, first zero index row.
Your second code reaches into the field of the table with the [Column]{RowNumber} syntax placed after the table reference (by the way, {0}[Column] = [Column]{0}, but performance can differ.
You can also just right click on a value in a table, and click Drill Down to get just the value itself.
One more thing that I find useful to remember: any function that returns a table can make use of this syntax. For example:
=Table.SelectRows(TableName, each [Date] >= SomeDateValue)
returns a table, and so you can easily add a field reference:
= Table.SelectRows(TableName, each [Date] >= SomeDateValue){0}[Sales]
By the way, you could probably save yourself a step and add the {0}[Column1] right after [Data] at the end of your last step, before the comma.
--Nate
2 Replies
- wdx223_DanielCommunity Champion
in your second step of #"Term1End2021_DefinedName", you get a table.
#"Term1End2021_DefinedName"{0} get the first row of the table, it's a record
#"Term1End2021_DefinedName"{0}[Column1] get the field of Column1 of the record
- AnonymousNot applicable
The first code returns type table--a table value that contains the value 44288 in [Column1]{0} which is Column1, first zero index row.
Your second code reaches into the field of the table with the [Column]{RowNumber} syntax placed after the table reference (by the way, {0}[Column] = [Column]{0}, but performance can differ.
You can also just right click on a value in a table, and click Drill Down to get just the value itself.
One more thing that I find useful to remember: any function that returns a table can make use of this syntax. For example:
=Table.SelectRows(TableName, each [Date] >= SomeDateValue)
returns a table, and so you can easily add a field reference:
= Table.SelectRows(TableName, each [Date] >= SomeDateValue){0}[Sales]
By the way, you could probably save yourself a step and add the {0}[Column1] right after [Data] at the end of your last step, before the comma.
--Nate