cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper III
Helper III

Using a variable for statement in PowerQuery Beta for SSIS

I'm trying to use the PowerQuery Beta for some SSIS packages.  I was curious if any one had used this, in particular the ability to set a PowerQuery equivalent to a variable.  I've "gotten" it to work if I use the simple method of declaring the full PowerQuery statement in the "Single Query Text" box.  However I'm unable to save a PowerQuery Statement to a string variable.  It get an evaluation error message.

 

Here's the query (just testing at this point)

 

 

let
    BaseDate = DateTime.LocalNow(),
    WeekStart = Date.AddDays(Date.StartOfWeek(BaseDate,1),7),
    PeriodList = List.Dates(DateTime.Date(WeekStart),Number.FromText("5"),#duration(Number.FromText("6")+1,0,0,0)),
    StartDates = Table.FromList(PeriodList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    EndDates = Table.AddColumn(StartDates,"EndDate",each Date.AddDays([Column1],Number.FromText("6")))
in
  EndDates

 

 

 

I get this error message when trying to save the Variable. I'm guessing I need to wrap the statement in something, but I don't know what that is.

 

 

TITLE: Expression Builder
------------------------------

Expression cannot be evaluated.

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%C2%AE%20Visual%20Studio%C2%AE&ProdVer=16.6.30204.135&Evtsrc=Microsoft.DataTransformationServices.Controls.TaskUIFramework.TaskUIFrameworkSR&EvtID=FailToEvaluateExpression&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

Attempt to parse the expression "let
    BaseDate = DateTime.LocalNow(),
    WeekStart = Date.AddDays(Date.StartOfWeek(BaseDate,1),7),
    PeriodList = List.Dates(DateTime.Date(WeekStart),Number.FromText("5"),#duration(Number.FromText("6")+1,0,0,0)),
    StartDates = Table.FromList(PeriodList, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    EndDates = Table.AddColumn(StartDates,"EndDate",each Date.AddDays([Column1],Number.FromText("6")))
in
  EndDates" failed. The expression might contain an invalid token, an incomplete token, or an invalid element. It might not be well-formed, or might be missing part of a required element such as a parenthesis.

 (Microsoft.DataTransformationServices.Controls)

 

 

 

The official page has nothing to help

https://docs.microsoft.com/en-us/sql/integration-services/data-flow/power-query-source?view=sql-serv...

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Using a variable for statement in PowerQuery Beta for SSIS

Hi @jnickell ,

 

Here is a blog about "Power Query Source for SQL Server Integration Services" for your reference:

https://www.mssqltips.com/sqlservertip/6305/power-query-source-for-sql-server-integration-services/

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Highlighted
Helper III
Helper III

Re: Using a variable for statement in PowerQuery Beta for SSIS

It looks like this article takes the same approach as others.  It requires a fully self contained power query statement.  It doesn't reference using the Power Query from a Variable approach.  

 

Sorry if there's a double post, the first one errored and it doesn't look like it saved it.

Helpful resources

Announcements
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Don't miss the Power BI Dev Camp this week!

August Community Highlights

Check out a full recap of the month!

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

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.

Top Solution Authors