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
Anonymous
Not applicable

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

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

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


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.