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
KaiPonte
Helper I
Helper I

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

KaiPonte
Helper I
Helper I

Wonderful! Thank you so much!!!

 

query editor.png

View solution in original post

3 REPLIES 3
KaiPonte
Helper I
Helper I

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.)

KaiPonte
Helper I
Helper I

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
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.