Forum Discussion

azakir's avatar
azakir
Resolver I
2 years ago
Solved

Schedule Refresh Not Working - Dynamic Data Source

Hi Guys.  I have a report that uses a number of tables. It refreshes fine on Power BI Desktop, but on service, I can't schedule refresh and get the following error:    I looked into my table...
  • azakir's avatar
    azakir
    2 years ago

    Thanks for the reply Anonymous. I did try the following to change from dynamic to static. Although I do like your solution better: 

     

    Data_ODC = Sql.Database("PSGSQL05", "BlastLogic_PRODUCTION_703_Site_ODC", [Query="
    SELECT 'BlastLogic_PRODUCTION_703_Site_ODC' AS DatabaseName, a.*,
    CASE WHEN a.CollarError > CollarErrorTolerance THEN 1 ELSE 2 END AS [SpatialAccuracy(XY)],
    CASE WHEN a.CollarZError > CollarZToleranceLowerBound AND a.CollarZError < CollarZToleranceUpperBound THEN 2 ELSE 1 END AS [SpatialAccuracy(Z)],
    CASE WHEN a.DrillDepthError > DrillDepthErrorToleranceLowerBound AND a.DrillDepthError < DrillDepthErrorToleranceUpperBound THEN 2 ELSE 1 END AS [DepthCompliance],
    CASE WHEN a.DrillDepthError > DrillDepthErrorToleranceLowerBound AND a.DrillDepthError < DrillDepthErrorToleranceUpperBound THEN 2
    WHEN a.DrillDepthError < DrillDepthErrorToleranceLowerBound THEN 3 ELSE 1 END AS [DepthCompliance2],
    FORMAT(a.DrillingCompletedTime, 'dd/MM/yyyy') AS DrillingCompletedDate,
    a.ActualDepth,
    c.LastDipDepth,
    a.TargetDrillDepth,
    CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END AS [Depth],
    (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth AS [Length],
    CASE WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - c.TargetChargeDepth > DrillDepthErrorToleranceUpperBound THEN 'Long'
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - c.TargetChargeDepth < DrillDepthErrorToleranceLowerBound THEN 'Short'
    ELSE 'WithinTolerance' END AS [DrillCompliance],
    CASE WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 1 THEN ' <1m'
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 3 THEN ' 1-3m'
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 5 THEN ' 3-5m'
    ELSE '>5m' END AS [LengthGrouping],
    CASE WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth < -1 THEN '<-1m'
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 0 THEN '-1-0m'
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 1 THEN '0-1m'
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 3 THEN '1-3m'
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 5 THEN '3-5m'
    ELSE '>5m' END AS [LengthGrouping],
    CASE WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth < -1 THEN 1
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 0 THEN 2
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 1 THEN 3
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 3 THEN 4
    WHEN (CASE WHEN c.LastDipDepth IS NULL THEN a.ActualDepth ELSE c.LastDipDepth END) - a.TargetDrillDepth <= 5 THEN 5
    ELSE 6 END AS [LengthGroupingSort]
    FROM DW.DrillingEntry a
    LEFT JOIN DW.SiteParameter b ON 1 = b.Id
    LEFT JOIN DW.Hole c ON a.HoleId = c.Id
    "]),

     

    Had to do it 4 times for all the DB