- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

custom function disobeying my data type declaration
Hello PBI folk,
I have a custom function that takes a text string of numeric digits as input and is supposed to return it as a text string, but when I look at the new column, it's showing as data type Any (ABC123), no matter what I do.
The function is trying to correct contract IDs, some with extra digit or missing leading zero's, so it has to remain a text string. The input parameter is of type Text, but the returned text data type doesn't survive the trip back to the new data column.
Here's a screenprint of the function.
Youth.ContractID "1300310" should return
Youth.ContractNumber "001300310"
but instead it returns "1300310"
Here's the screenshot:
Any hints or clues for me?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Does it help if you add ", type text" before the last parenthesis that closes Table.AddColumn?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Alexis,
thanks for your response and, while it wasn't the solution, it put me on the right track to fix it.
You'll notice the function name (9DigitContractID) didn't match the function call in the step (CleanContractNumber), so I was calling the wrong function all the time!
So, fixed after staring at this thing for about a half-hour.
THANKS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Does it help if you add ", type text" before the last parenthesis that closes Table.AddColumn?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi Alexis,
thanks for your response and, while it wasn't the solution, it put me on the right track to fix it.
You'll notice the function name (9DigitContractID) didn't match the function call in the step (CleanContractNumber), so I was calling the wrong function all the time!
So, fixed after staring at this thing for about a half-hour.
THANKS

Helpful resources
Join our Fabric User Panel
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Power BI Monthly Update - June 2025
Check out the June 2025 Power BI update to learn about new features.

User | Count |
---|---|
15 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
15 | |
13 | |
8 | |
7 | |
6 |