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

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

Reply
Anonymous
Not applicable

Help viewing query

I am developing reports in PowerBI for data which resides in an Amazon redshift instance.  I write the query on the server, then import it into PowerBI. There are no stored procedures available, so I can't go this route. My question is - how do I edit the query from the report? I write the query so it looks like this:

SELECT
pwc.poll_worker_id AS "Pollworker ID",
pw.first_name AS "Pollworker First Name",
pw.last_name AS "Pollworker Last Name",
pp.name AS "Polling Place",
pp.code AS "Polling Place Code"
FROM
public.poll_worker_checkins AS pwc
INNER JOIN
public.poll_workers AS pw ON pw.id=pwc.poll_worker_id
INNER JOIN
public.polling_places AS pp ON pp.id=pwc.assigned_polling_place_id
WHERE
pwc.election_id=460
ORDER BY
pwc.poll_worker_id

 

 

But then after I load it in PowerBI and go to Power Query Editor, I get this:

 

= Value.NativeQuery(AmazonRedshift.Database("redshift.amazonaws.com","epulse"), "SELECT#(lf)#(tab)pwc.action as ""Action Type"",#(lf)#(tab)pwc.time as ""time of checkin/out"",#(lf)#(tab)pwc.poll_worker_id as ""Pollworker ID"",#(lf)#(tab)pw.first_name as ""Pollworker First Name"",#(lf)#(tab)pw.last_name as ""Pollworker Last Name"",#(lf)#(tab)#(tab)-- FORMAT(pwc.time, 'hh:mm') as ""time of checkin/out"",#(lf)#(tab)pp.name as ""Vote Center"",#(lf)#(tab)pp.code as ""Vote Center Code""#(lf)FROM#(lf)#(tab)public.poll_worker_checkins as pwc#(lf)inner JOIN#(tab)#(lf)#(tab)public.poll_workers as pw on pw.id=poll_worker_id#(lf)INNER JOIN#(lf)#(tab)public.polling_places AS pp ON pp.id=pwc.assigned_polling_place_id#(lf)WHERE#(lf)#(tab)pwc.election_id=460#(lf)ORDER BY#(lf)#(tab)pwc.poll_worker_id", null, [EnableFolding=true])

2 ACCEPTED SOLUTIONS
christinepayton
Super User
Super User

Typically if you click on the gear icon next to the source step, it gives you a more formatted version of the text there, without all of the #(lf)s. Unsure if the Redshift connection will, but I've used this with SQL Server for sure. 

View solution in original post

Anonymous
Not applicable

Wonderful! Thank you so much!!!

 

query editor.png

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Yes, it worked perfectly.  I now need to figure out if I can make stored procedures in Amazon Redshift.  I despise having in-line code and much prefer stored procs to make coding easier.  (Don’t worry about that gripe, I need to take it up with our vendor, who chose Amazon instead of SQL Server.)

Anonymous
Not applicable

Wonderful! Thank you so much!!!

 

query editor.png

christinepayton
Super User
Super User

Typically if you click on the gear icon next to the source step, it gives you a more formatted version of the text there, without all of the #(lf)s. Unsure if the Redshift connection will, but I've used this with SQL Server for sure. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.