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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Gauravshahin
Frequent Visitor

Text.AfterDelimiter in transformation step did not change column type

Hi Experts,

I used = Table.TransformColumns(#"Unpivoted Columns", {{"FcstWK", each Text.AfterDelimiter(_, "k"), type number}}) to extract Week Numbers from below column.

Durinng this step, I specify that column type should be number however, when I used Value.Type to check the column type it is showing me as text. 
Can anyone pls help me understnad how is it possible?
= Table.TransformColumns(#"Unpivoted Columns", {{"FcstWK", each Text.AfterDelimiter(_, "k"), type number}})

= Table.AddColumn(#"Extracted Text After Delimiter", "Custom", each Value.Type([FcstWK]))

 

Gauravshahin_0-1731452791035.png

 

 

FcstWK
PlannedQuantityWeek0
PlannedQuantityWeek1
PlannedQuantityWeek10
PlannedQuantityWeek11
PlannedQuantityWeek12
PlannedQuantityWeek2
PlannedQuantityWeek3
PlannedQuantityWeek4
PlannedQuantityWeek5
PlannedQuantityWeek6
PlannedQuantityWeek7
PlannedQuantityWeek8
PlannedQuantityWeek9

 

2 ACCEPTED SOLUTIONS
PhilipTreacy
Super User
Super User

@Gauravshahin 

 

What seems to be happening is that the data is transformed to a number, but the type of the column remains as text, so the numbers are treated as text.  I can't tell you why it's doing this as it seems wrong.

 

Even if you do this

 

each Number.From(Text.AfterDelimiter(_, "k"))

 

the column is still an ANY type (ABC 123) rather than number.  Seems that PQ is treating the column type and the data in the column as different types.  A bug?  Or by design?  I don't know why you'd have a column of one type and the data within treated as a different type.

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

Thank you for your reply @PhilipTreacy.
I have done the work around and it seems to be working for now.
Since we now know that, output from Text.AfterDelimiter(_, "k") will always be ANY, I nested it with Number.FromText and specify column type as Number.


= Table.TransformColumns(#"Unpivoted Columns", {{"FcstWK", each Number.FromText(Text.AfterDelimiter(_, "k")), type number}})

However, I am still unsure why Table.TransformColumns is not converting it to number.

Gauravshahin_0-1731456374998.png

 

 

Preview
 
 
 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I know this is solved, but @PhilipTreacy I think it's the opposite: the column is being changed to type number, but the values are still type text, which is still funny because the function returns type any:

 

Text.AfterDelimiter(text as nullable text, delimiter as text, optional index as any) as any

I'd be curious to know what the result is of you checking the column type as opposed to the value type:

Type.TableColumn(tableType as type, column as text) as type

This will return the column type as opposed to the value type. Not that this solved your question...

I'd also be curious to know the result if you used Number.FromText instead of Number.From. People say that they are equivalent, but in this case, I suspect they are not exactly the same.

 

--Nate 

PhilipTreacy
Super User
Super User

@Gauravshahin 

 

What seems to be happening is that the data is transformed to a number, but the type of the column remains as text, so the numbers are treated as text.  I can't tell you why it's doing this as it seems wrong.

 

Even if you do this

 

each Number.From(Text.AfterDelimiter(_, "k"))

 

the column is still an ANY type (ABC 123) rather than number.  Seems that PQ is treating the column type and the data in the column as different types.  A bug?  Or by design?  I don't know why you'd have a column of one type and the data within treated as a different type.

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thank you for your reply @PhilipTreacy.
I have done the work around and it seems to be working for now.
Since we now know that, output from Text.AfterDelimiter(_, "k") will always be ANY, I nested it with Number.FromText and specify column type as Number.


= Table.TransformColumns(#"Unpivoted Columns", {{"FcstWK", each Number.FromText(Text.AfterDelimiter(_, "k")), type number}})

However, I am still unsure why Table.TransformColumns is not converting it to number.

Gauravshahin_0-1731456374998.png

 

 

Preview
 
 
 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors
Top Kudoed Authors