cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Power BI SQL Syntax Error

Hi All,

 

Need your help in understanding wherer the syntax is getting wrong, When upload to Power BI SQL server i am getting  "Incorrect syntax near ','."

Any ideas.

CLOSED_CASE_DTL AS (
SELECT E.EQUIP_ID,
E.CASE_NUMBER,
E.CASE_TYPE,
E.SUBJECT_REF,
E.SUBJECT_ID,
E.CONTEXT_ID,
E.CASE_SUBTYPE,
E.RECEIVED_DATE,
E.[START_DATE] CASE_START_DATE,
E.END_DATE CASE_END_DATE,
E.[STATUS],PR.REGION_ID REGION,
P.PLAN_NAME,
PR.PLAN_ID,
R.REGION_ID,
S.DESCRIPTION SOURCE,
R.[DESCRIPTION],
E.DELIVERY_SOURCE,
0 AGE,
W.ODSDATABASE,
W.PLANSKEY,
E.END_DATE END_DATE,
E.END_USER USERNAME,
E.END_REASON,
'CLOSED CLAIMS' CLAIMS
from DBO.EQUIP_HEADER E JOIN DBO.CONTEXT C ON E.CONTEXT_ID = C.CONTEXT_ID
JOIN DBO.[PLAN] P ON C.CONTEXT_ID = P.PLAN_ID
JOIN DBO.INS_PLAN_CONTROL PR ON P.PLAN_ID = PR.PLAN_ID
JOIN DBO.REGION R ON PR.REGION_ID = R.REGION_ID
JOIN WAREHOUSETEMP.DBO.VFETCHPLANDETAILS W ON P.PLAN_ID = W.AASPLANCODE
JOIN DBO.STANDARD_CODE S ON E.DELIVERY_SOURCE=S.CODE
JOIN PLN P1 ON P1.PLAN_ID=P.PLAN_ID
JOIN REGION R1 ON R.REGION_ID=R1.REGION_ID
where E.CONTEXT_TYPE='*PLAN'
AND E.CASE_TYPE='CLM_INS'
AND C.CONTEXT_STATUS='A'
AND P.STATUS='A'
AND E.[STATUS] = 'C'
AND S.TYPE='SOURCE'
--AND E.END_DATE BETWEEN @FROMDATE AND @TODATE
AND E.END_DATE >= dateadd(day, datediff(day, 0, getdate()) - 1, 0) and E.END_DATE < getdate()
),

1 ACCEPTED SOLUTION
Super User IV
Super User IV

Are you putting this SQL in the Advanced box of the SQL Server connector?  Does it work when you remove the CLOSED_CASE_DTL(      )  wrapper?

Also, why do some fields have square brackets and most don't?

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
Super User IV
Super User IV

Are you putting this SQL in the Advanced box of the SQL Server connector?  Does it work when you remove the CLOSED_CASE_DTL(      )  wrapper?

Also, why do some fields have square brackets and most don't?

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Helpful resources

Announcements
secondImage

Experience what’s next for Power BI

Join us for an in-depth look at the new Power BI features and capabilities at the free Microsoft Business Applications Launch Event.

secondImage

Power BI Women

Join our monthly meetings and learning sessions.

secondImage

Congratulations!

We are excited to announce the Power BI Super Users!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors