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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
computasian
New Member

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.

computasian_1-1696012114855.png

 

 

Youth.ContractID "1300310" should return

Youth.ContractNumber "001300310"

but instead it returns "1300310"

Here's the screenshot:

computasian_2-1696012329167.png

 

Any hints or clues for me?

 

2 ACCEPTED SOLUTIONS
AlexisOlson
Super User
Super User

Does it help if you add ", type text" before the last parenthesis that closes Table.AddColumn?

View solution in original post

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

View solution in original post

2 REPLIES 2
AlexisOlson
Super User
Super User

Does it help if you add ", type text" before the last parenthesis that closes Table.AddColumn?

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

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.