Nullable text?

Tigerexcel

Active Member
Joined
Mar 6, 2020
Messages
493
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Book3
AB
1PositionRep
2HRJack
3SalesFred
4FinanceJack
5AdminPete
6MgtJack
7TrainingFred
8SecurityFred
9ITJack
Sheet1


let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Position", type text}, {"Rep", type text}}),
#"Grouped Rows" = #!"Table.Group(#""Changed Type"", {""Rep""}, {{""Count"", each [Rep], type list [Position=nullable text, Rep=nullable text]}})"
in
#"Grouped Rows"

Using PQ to return grouped by records, as in Jack HR, Finance, Mgt, IT
I get a Token comma expected message, I've tried inserting commas in various places but to no avail. When I remove the "[Position=nullable text, Rep=nullable text]" the command works and returns the grouped records.
What does the nullable text information come up as I haven't noticed it before? Where is the token comma supposed to go to make this work if I leave the nullable text info in?
 
Hi again Sandy,

Just trying to do a simple group by, where the Rep is grouped so that we get Jack HR, Finance etc. then Fred Sales, Training etc.
I have to Convert from Table to List which normally works fine but the Nullable text entries seem to give me an error unless I remove them.
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Could you post expected result from your example (post#1) ?
I still don't understand your change in the grouping line,
you can simply add column with List.Distinct([Count][Rep])
 
Upvote 0
Could you post expected result from your example (post#1) ?
I still don't understand your change in the grouping line,
you can simply add column with List.Distinct([Count][Rep])
Desired result
Book3
AB
1RepCount
2JackHR,Finance,Mgt,IT
3FredSales,Training,Security
4PeteAdmin
Sheet4
 
Upvote 0
RepList
JackHR,Finance,Mgt,IT
FredSales,Training,Security
PeteAdmin

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Rep"}, {{"Count", each _, type table}}),
    List = Table.AddColumn(Group, "List", each List.Distinct([Count][Position])),
    Wxtract = Table.TransformColumns(List, {"List", each Text.Combine(List.Transform(_, Text.From), ","), type text})
in
    Wxtract
grp.png
 
Upvote 0
Thanks Sandy, my question is not so much how to solve this but:
1) where do the entries [Position=nullable text, Rep=nullable text] come from? I haven't seen them before
2) The code below indicates Token Comma error, can it be fixed by inserting a comma somewhere?
Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Position", type text}, {"Rep", type text}}),
    #"Grouped Rows" = #!"Table.Group(#""Changed Type"", {""Position""}, {{""Count"", each [Rep], type list [Position=nullable text, Rep=nullable text]}})"
in
    #"Grouped Rows"
 
Upvote 0
Last edited:
Upvote 0
1. how you did it?
2. as you can see whole line is an error #!
3. check data types
4. you are trying to use "list" inside table type group

for more info how Power Query works
When I remove the [Position=nullable text, Rep=nullable text] it works perfectly. I wonder if I have accidentally changed a setting which brings this statement up. I can't find much on this on the Internet.
 
Upvote 0
I wonder if I have accidentally changed a setting which brings this statement up
I don't know what you did and how you did it

The standard library does include a collection of functions to extract the defining characteristics from a custom
type, so specific compatibility tests can be implemented as M expressions. Below are some examples; consult the
M library specification for full details

Rich (BB code):
Type.ListItem( type {number} )
// type number
Type.NonNullable( type nullable text )
// type text
Type.RecordFields( type [A=text, B=time] )
// [ A = [Type = type text, Optional = false],
// B = [Type = type time, Optional = false] ]
Type.TableRow( type table [X=number, Y=date] )
// type [X = number, Y = date]
Type.FunctionParameters(
type function (x as number, optional y as text) as number)
// [ x = type number, y = type nullable text ]
Type.FunctionRequiredParameters(
type function (x as number, optional y as text) as number)
// 1
Type.FunctionReturn(
type function (x as number, optional y as text) as number)
// type number
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,757
Messages
6,174,322
Members
452,555
Latest member
colc007

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top