The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I only want to return the first result from each table from each row. How do I do this? Some tables only ahve 1 item, others have 4 or more, the first is always the one I want.
Formula after I expand the tables:
= Table.ExpandTableColumn(#"Expanded Device", "NetworkInterface", {"sNetworkAddress", "sNetworkName"}, {"sNetworkAddress", "sNetworkName"})
Picture to match formula:
Thanks!
Solved! Go to Solution.
You can try with step below
= Table.ExpandTableColumn( Table.TransformColumns(#"Expanded Device",{ "NetworkInterface", each Table.FirstN(_,1)}) , "NetworkInterface", {"sNetworkAddress", "sNetworkName"}, {"sNetworkAddress", "sNetworkName"})
Even cleaner:
= Table.TransformColumns(#"Table or Last Step Name", {{"NetworkInterface", each Table.FirstValue(_)}})
--Nate
If you are saying you want the first value from the first cow of each table, it's Table.AddColumn(#"Name of Your Last Step or Table Name", "First", each Table.FirstValue([NetworkInterface]))
--Nate
You can try with step below
= Table.ExpandTableColumn( Table.TransformColumns(#"Expanded Device",{ "NetworkInterface", each Table.FirstN(_,1)}) , "NetworkInterface", {"sNetworkAddress", "sNetworkName"}, {"sNetworkAddress", "sNetworkName"})
Great solution, just what I needed!
How would you sort this in decending order BEFORE getting the first row? Turns out the data needs to be sorted first to get the expected first item.
= Table.ExpandTableColumn( Table.TransformColumns(#"Expanded Device",{ "NetworkInterface", each Table.FirstN (Table.Sort(_,{{"sNetworkName", Order.Descending}}) ,1)}) , "NetworkInterface", {"sNetworkAddress", "sNetworkName"}, {"sNetworkAddress", "sNetworkName"})
You can add a custom column with this formula to keep just the top record (row) of your tables.
= Table.FirstN([NetworkInterface],1)
or
= [NetworkInterface]{0}
You can then delete the original column and expand the new one.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.