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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shekhar_shres
Helper II
Helper II

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

shekhar_shres_1-1624575000252.png

Table

shekhar_shres_0-1624574924845.png

 

The thing is I do not want it as table but as a blank list as follows:

 

3 - The requirement

shekhar_shres_2-1624575192881.png

 

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)

shekhar_shres_3-1624575299764.png

 

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

 



 



 

 

2 ACCEPTED SOLUTIONS
wdx223_Daniel
Super User
Super User

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

View solution in original post

watkinnc
Super User
Super User

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

 


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

2 REPLIES 2
watkinnc
Super User
Super User

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

 


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
wdx223_Daniel
Super User
Super User

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors