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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Analitika
Post Prodigy
Post Prodigy

Error in SQL query in Power BI in advanced editor (PostgreSQL)

Hello,

 

I have a SQL (PostgreSQL) which not works, I am writing that SQL in Power BI advanced editor. 

 

SELECT rws.zu0_kod AS zu0_kod,
rws.did_nr AS did_nr,
rws.adm_var AS adm_var,
rws.did_dat AS did_dat
,COUNT (1) AS eil.skaicius
FROM (SELECT tab1.zu0_kod,
tab1.did_nr,
tab1.adm_var,
tab1.did_dat
FROM (SELECT id_vidp AS id_vidp2,
zu0_kod AS zu0_kod,
AS did_nr,
adm_var AS adm_var,
did_dat AS did_dat
FROM s.vidp
WHERE s.vidp.did_dat >= filterdate) tab1
LEFT OUTER JOIN s.vidp tab2
ON tab1.id_vidp2 = tab2.id_vidp) rws

 

I am getting this error:

DataSource.Error: ODBC: ERROR [42601] ERROR: syntax error at or near ".";
Error while executing the query
Details:
DataSourceKind=Odbc
DataSourcePath=dsn=dbname
OdbcErrors=[Table]

2 REPLIES 2
amitchandak
Super User
Super User

@Analitika , Rename of count seems to have issue

 

SELECT rws.zu0_kod AS zu0_kod,
rws.did_nr AS did_nr,
rws.adm_var AS adm_var,
rws.did_dat AS did_dat
,COUNT (1) AS eil_skaicius
FROM (SELECT tab1.zu0_kod,
tab1.did_nr,
tab1.adm_var,
tab1.did_dat
FROM (SELECT id_vidp AS id_vidp2,
zu0_kod AS zu0_kod,
AS did_nr,
adm_var AS adm_var,
did_dat AS did_dat
FROM s.vidp
WHERE s.vidp.did_dat >= filterdate) tab1
LEFT OUTER JOIN s.vidp tab2
ON tab1.id_vidp2 = tab2.id_vidp) rws

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak 

SELECT rws.zu0_kod AS zu0_kod,
rws.did_nr AS did_nr,
rws.adm_var AS adm_var,
rws.did_dat AS did_dat
,COUNT (1) AS ""eil.skaicius""
FROM (SELECT tab1.zu0_kod,
tab1.did_nr,
tab1.adm_var,
tab1.did_dat
FROM (SELECT id_vidp AS id_vidp2,
zu0_kod AS zu0_kod,
did_nr AS did_nr,
adm_var AS adm_var,
did_dat AS did_dat
FROM public.vidp
WHERE public.vidp.did_dat >= '" & sFilterDate & "') tab1
LEFT OUTER JOIN public.vidp tab2
ON tab1.id_vidp2 = tab2.id_vidp) rws
GROUP BY rws.zu0_kod,
rws.did_nr,
rws.adm_var,
rws.did_dat

 

Getting empty table:

 

Analitika_0-1630929327561.png

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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