cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jazz-123
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
mahoneypat
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
mahoneypat
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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

March Update

Check it Out!

Click here to read more about the March 2021 Updates!

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.

secondImage

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.