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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
dvp
Helper I
Helper I

Azure Data Explorer / Kusto with dynamic column

I have the following function in ADX/Kusto:

 

.create-or-alter function with (docstring = "Customers View",folder = "Views") CustomersTest {
    datatable (CustomerId:string, StateReasons:dynamic) [
        "ee1eaead-5f6d-4371-80cb-7881679f8116", dynamic(["Reason1""Reason2"]) ]
    | extend StateReasons[0], StateReasons[1]
}
 
When I try to display e.g. CustomerId and StateReasons (or StateReasons_0, StateReasons_1) using DirectQuery in Power BI Desktop I get the following cryptic error:
 

Release:
December 2020

Product Version:
2.88.1385.0 (20.12) (x64)

Error Message:
OLE DB or ODBC error: [Bad request] Request is invalid and cannot be executed..

 

Any clue how to resolve this one?

1 ACCEPTED SOLUTION
dvp
Helper I
Helper I

There seem to be 2 solutions to the issue:

 

1) Replace

 

 | extend StateReasons[0], StateReasons[1]

 

with 

 

 | extend tostring(StateReasons[0]), tostring(StateReasons[1])

 

in the function

 

2) Add a Data Transformation step in Power BI Desktop and set the data type of the 2 columns to Text ...

View solution in original post

2 REPLIES 2
dvp
Helper I
Helper I

There seem to be 2 solutions to the issue:

 

1) Replace

 

 | extend StateReasons[0], StateReasons[1]

 

with 

 

 | extend tostring(StateReasons[0]), tostring(StateReasons[1])

 

in the function

 

2) Add a Data Transformation step in Power BI Desktop and set the data type of the 2 columns to Text ...

v-easonf-msft
Community Support
Community Support

Hi , @dvp 

Sorry I can't fix it on my side,it is recommended to open a support ticket to let engineers look into the issue on your side.

Support Ticket.gif

 

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.