Forum Discussion
SET datefirst 1 DirectQuery
- 8 years ago
Thanks guys, i found out the right solution!!
When using Direct Query mode in Power BI Desktop, it will always pass the SQL statement like:
select * from ( -your SQL query- )
That's the reason why it throws syntax error.
See a similar thread:
https://community.powerbi.com/t5/Desktop/SQL-parameters-in-direct-query/td-p/248180
I'm afraid you have to adjust the logic in your where clause.
Regards,
- miltenburger8 years ago
Helper V
Thanks v-sihou-msft for yuor answer,
I'm trying to get it in my WHERE clause, but what i can find on the internet won't help.
I tried this:
declare @MyDate datetime = getdate()
selectSELECT
CASE WHEN DATEPART(DW,CreatedDateTime) = 1
THEN 7
WHEN DATEPART(DW,CreatedDateTime) <= 7
THEN DATEPART(DW,CreatedDateTime) - 1
END
FROM myDB
WHERE CreatedDateTime >= DATEADD(day, -(DATEPART(dw, GETDATE()) + 6), CONVERT(DATE, GETDATE()))
AND CreatedDateTime < DATEADD(day, 1 - DATEPART(dw, GETDATE()), CONVERT(DATE, GETDATE()))
AND Minutes is not null
AND Minutes > 0
AND TicketNumber like 'CH%'
AND User like 'itsn%'
AND TicketNumber is not nullThis won't work, guys got any idea to help me further?
- miltenburger8 years ago
Helper V
- 1 select ofcourse, typo
- miltenburger8 years ago
Helper V
Thanks guys, i found out the right solution!!