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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
JohnnyDax
Frequent Visitor

Noobie question about SQL Query

My coworker left me a dataset which is connected to an azure pool and i need to add another column in it.

 

He used a specific SQL request to load his data and i expected to just edit that request by clicking on the gear near "Source" but it's not here. The only way i could edit his request is to edit the power query request but i've never seen something like this before and i'm pretty sure he didn't code it like this himself :

JohnnyDax_0-1670362563811.png

This is a sample of the whole request,

Is there another way to edit the SQL request without rewriting it in this format ? 

I don't know if i'm clear...!

 

Thank you

5 REPLIES 5
JohnnyDax
Frequent Visitor

Hi,

 

Thank you for your answer,

 

@mussaenda double click on source does nothing in my case

@sevenhills i don't have the gear icone near source as usual, i suspect he just copy/pasted his request from another PBix, the "show native request" option is also greyed and can't be choosen

 

I guess i have to rewrite the request properly or edit it in M but that doesn't look easy compared to an SQL request.

Note: Always the first few steps are the ones where we connect. Then apply the query. if we know the steps, it will be easy to change or edit. 

 

Like I said in previous post, you can see all code in the advanced editor. and change.

 

Remove all sensitive info and

Please Share the code, I can take a look

Or share the screenshots

Or share the .pbix file.


Hi @JohnnyDax 

 

When you use a custom SQL statement when connecting to a database, the "view native query" option will be disabled. This is by design. 

 

Are you using Power BI Desktop? In my test, I can click the gear icon or double-click on Source step to open the data source connection window. You will see that Power BI will add special characters automatically.  

vjingzhang_0-1670404736634.png

 

If you cannot open this connection window, you can copy that SQL statement outside and paste it into a Text editor, and remove those special characters. Then it will be easier to edit the SQL statement. After you add the column, copy the new statement into a new query to test the connection first. When you ensure the new table is queried correctly, paste its SQL statement string into the old query's Source step. This should be possible. 

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

mussaenda
Super User
Super User

Hi @JohnnyDax ,

 

Double Click the Source.

It will show the native query.

Add the column you need and click okay.

 

It will load.

Hope this helps

sevenhills
Super User
Super User

Based on the screenshot, the query is auto generated, which is common. FYI, #(lf) .. line feed; 

#(tab) ... tab;

 

Before doing the changes, take a copy and work on it first, to get the solution

 

Option 1: Editing source in Applied Steps:

Select the query in Power Query Editor

Right side, you see the applied steps. Click the gear icon next to Source and see if you can change the query here.

 

Option 2: Code mode:

To add another simple column, edit the query in "power query editor" window using "Advanced Editor"...

change

        ,#(lf)#(tab)#(tab)m.nom_service,

as 

       ,#(lf)#(tab)#(tab)m.nom_service,,#(lf)#(tab)#(tab)t1.newcolname,

 

See if this works.

 

Hope this helps!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors
Top Kudoed Authors