Forum Discussion

jader3rd's avatar
jader3rd
Microsoft Employee
9 years ago
Solved

Applying filtered rows to the source

I'm connecting to a SQL view which has a lot of rows. Most of the time when we view the data we're going to be most interested in the last week or twos worth of data. I created StartTime and EndTime ...
  • Anonymous's avatar
    Anonymous
    9 years ago

    jader3rd,

    Change your codes to the following.

    let
        SQLSource = (StartTime as datetime, EndTime as datetime) => 
    let
        Source = Sql.Database("MF-APDM-Shared1AlwaysOnVIP.OBDStripeDedicated-Prod-Bn2.Bn2.ap.gbl,89", "MDP_EXOMI", [Query="SELECT CONVERT(DATE, [START_TIME]) AS Day, [ACTION_REASON], [CHECKFAILED], COUNT(*) AS Cnt FROM [dbo].[HAOpBcsFailed] WHERE [START_TIME] >= '"& DateTime.ToText(StartTime) & "' AND [START_TIME] <= '"& DateTime.ToText(EndTime)&"' GROUP BY CONVERT(DATE, [START_TIME]), [ACTION_REASON], [CHECKFAILED]"]) 
    in
        Source
    in 
        SQLSource


    Regards,
    Lydia