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 August 31st. Request your voucher.

Reply
dedelman_clng
Community Champion
Community Champion

Cannot convert type Binary to type Text - Text.ToBinary

dedelman_clng_0-1711030859402.png

 

I am getting the above error message on this piece of PowerQuery code

 

 

body = Text.ToBinary(Json.FromValue([login_id = client_id, security_key = client_secret]))

 

 

client_id and client_secret are defined as parameters, type "Text" and they are alphanumerics strings except for a single "@" in client_id and a single "-" in client_secret

 

The error doesn't even make any sense as I thought we're converting to binary not from binary.

 

I'm on Version: 2.126.927.0 64-bit (February 2024) if that makes any difference.

 

Any help appreciated,

David

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

That's because JSON.FromValue outputs a binary type, which you are then wrapping in Text.ToBinary. So you are now feeding the Text.ToBinary function an already binary value (the JSON.FromValue). PQ is saying " this value is not text".

 

--Nate

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Can't you just remove the Binary.FromText function?

Anonymous
Not applicable

That's because JSON.FromValue outputs a binary type, which you are then wrapping in Text.ToBinary. So you are now feeding the Text.ToBinary function an already binary value (the JSON.FromValue). PQ is saying " this value is not text".

 

--Nate

Thanks Nate. I got that code from a MS support resource in another thread so I assumed it was correct code. Back to the drawing board...

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

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.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors