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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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