Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hello, Your help is appreciated.
In Power query when I use Groupby (in my excel 2016 pro) the answer at the end of the code show " type table" and NOT listing the columns and their types. When I have several or tens of columns how to list them after " type table" with their types
I saw some videos (RICK DE GROOT) they show the columns and their types (after "type table" ) saving the time, when expanding the next step of Groupby. No additional change type step.
Here is the steps and its result my Excel 2016 pro is getting:
= Table.Group(#"Changed Type", {"Case.CC.EEName"}, {{"Details", each fx_RefertoPreviousRunningCalc("Calculated Tenure", _, "Index.inGrp", "Yr Move Out", "NoEE") , type table}})
Rick de Groot gets:
Got the following:
= Table.Group(#Sorted Rows", {"Product},{{"Details", each_, type table [Date=nullable date, Pruduct = nullable text, Amount= nullable number]}})
using Power bi
at 9.23 minute at: https://www.youtube.com/watch?v=ShnWkb6e0jE
Table.Group(#"Changed Type", {"Case.CC.EEName"}, {{"Details", each fx_RefertoPreviousRunningCalc("Calculated Tenure", _, "Index.inGrp", "Yr Move Out", "NoEE") , type table}})
Is is related to setting up Excel power query or Version of excel or might be in power query... or...?
how can I after "type table" get "[Case.CC.EEName=nullable text, Index.inGrp = nullable text, .....NoEE= nullable number....]}})
Thanks
Solved! Go to Solution.
HelloIbendlin,
How go i get name of columns listed with their original type before grouping, during the Table.Group, as
Rick de Groot gets:
Got the following:
= Table.Group(#Sorted Rows", {"Product},{{"Details", each_, type table [Date=nullable date, Pruduct = nullable text, Amount= nullable number]}})
using Power bi
at 9.23 minute at: https://www.youtube.com/watch?v=ShnWkb6e0jE
Table.Group(#"Changed Type", {"Case.CC.EEName"}, {{"Details", each fx_RefertoPreviousRunningCalc("Calculated Tenure", _, "Index.inGrp", "Yr Move Out", "NoEE") , type table}})
Is is related to setting up Excel power query or Version of excel or might be in power query... or...?
how can I after "type table" get "[Case.CC.EEName=nullable text, Index.inGrp = nullable text, .....NoEE= nullable number....]}})
Thanks
Execute the Table.Group function from the UI and select "All Rows" for the operation.
Power Query will generate the type table[...] with the existing columns and types.
Then you can enter the Advanced Editor and edit to create your custom aggregation.
Hi @DSR ,
Thanks for reaching out to the Microsoft Fabric Community.
Just checking in to see if your issue is resolved by now. If not, please consider the following:
When using a custom function inside a Table.Group operation, as in your case with fx_RefertoPreviousRunningCalc, Power Query doesn’t auto-generate the column schema in the type table [...] format. That behavior is only available when you select All Rows directly in the UI, which Power Query handles behind the scenes, as previously noted by @ZhangKun.
To include the detailed column schema during grouping without manually typing it out, you can leverage the Value.Type function to extract the structure of your original table before grouping:
Table.Group(YourTable, {"GroupColumn"}, {{"Details", each fx_RefertoPreviousRunningCalc(...), Value.Type(YourTable)}})
This ensures the grouped column preserves the column names and data types from the original table.
In case you resolved it in a different way, please feel free to share your approach here, it could help others facing the same issue.
If any of the responses in this thread were helpful, kindly mark them as Accepted Solution to assist others with similar queries. A kudos would also be appreciated.
Thank you.
I think i understand your question. you'd know "type table" equal "type table [...]". this means that when you use "type table", it will override the type of the original table.
you can try to expanding three column in following code and see the difference:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTJSitWBsEzALCMgywzMMgayLOAsS6XYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [A = _t, B = _t]),
ChangedType = Table.TransformColumnTypes(Source,{{"A", type text}, {"B", Int64.Type}}),
GroupBy1 = Table.Group(ChangedType, {"A"}, {{"Rows", each _, type table}}),
GroupBy2 = Table.Group(ChangedType, {"A"}, {{"Rows", each _, type table [A = text, B = number]}}),
GroupBy3 = Table.Group(ChangedType, {"A"}, {{"Rows", each _, Value.Type(ChangedType)}})
in
GroupBy3
Thank you Zhanghun,
How go i get name of columns listed with their original type before grouping, during the Table.Group, as
Rick de Groot gets:
Got the following:
= Table.Group(#Sorted Rows", {"Product},{{"Details", each_, type table [Date=nullable date, Pruduct = nullable text, Amount= nullable number]}})
using Power bi
at 9.23 minute at: https://www.youtube.com/watch?v=ShnWkb6e0jE
Table.Group(#"Changed Type", {"Case.CC.EEName"}, {{"Details", each fx_RefertoPreviousRunningCalc("Calculated Tenure", _, "Index.inGrp", "Yr Move Out", "NoEE") , type table}})
Is is related to setting up Excel power query or Version of excel or might be in power query... or...?
how can I after "type table" get "[Case.CC.EEName=nullable text, Index.inGrp = nullable text, .....NoEE= nullable number....]}})
Thanks
"how can I after "type table" get "[Case.CC.EEName=nullable text, Index.inGrp = nullable text, .....NoEE= nullable number....]}})"
selected "All Rows", and power query will add detail type.
You are using a custom grouping function. That means you also need to provide the custom meta data in that step - or you do it in subsequent steps when you use the aggregation columns.
HelloIbendlin,
How go i get name of columns listed with their original type before grouping, during the Table.Group, as
Rick de Groot gets:
Got the following:
= Table.Group(#Sorted Rows", {"Product},{{"Details", each_, type table [Date=nullable date, Pruduct = nullable text, Amount= nullable number]}})
using Power bi
at 9.23 minute at: https://www.youtube.com/watch?v=ShnWkb6e0jE
Table.Group(#"Changed Type", {"Case.CC.EEName"}, {{"Details", each fx_RefertoPreviousRunningCalc("Calculated Tenure", _, "Index.inGrp", "Yr Move Out", "NoEE") , type table}})
Is is related to setting up Excel power query or Version of excel or might be in power query... or...?
how can I after "type table" get "[Case.CC.EEName=nullable text, Index.inGrp = nullable text, .....NoEE= nullable number....]}})
Thanks