Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Machine Learning Error

Hi, I am trying out the new AI capabilities of Power BI but I am running into some weird errors, that I can't make sense of.

I am running this tutorial: https://docs.microsoft.com/en-us/power-bi/service-tutorial-build-machine-learning-model

Everything goes well with quering, creating a ML model and up until the "Refresh the dataflow" part of the tutorial.

Where it gives me the following error report. Can anyone make sense of this, and what I am doing wrong?

 

Run timeDataflow nameDataflow refresh statusEntity nameStart timeEnd timeEntity refresh statusError
15-04-2019 13:53Online Shoppers IntentFailedOnline Visitor15-04-2019 13:5315-04-2019 13:53Completed 
15-04-2019 13:53Online Shoppers IntentFailedPurchase Intent Prediction15-04-2019 13:5315-04-2019 13:53FailedError: One or more upstream operations failed... RootActivityId = 5d8a6495-df6f-425b-8dbd-8188366137d1 Request ID: 1e6fe497-30b3-5707-42ca-285f1747a7ff.
15-04-2019 13:53Online Shoppers IntentFailedPurchase Intent Prediction Training Data15-04-2019 13:5315-04-2019 13:53FailedError: An internal error occurred... RootActivityId = 5d8a6495-df6f-425b-8dbd-8188366137d1.Param1 = An error happened while reading data from the provider: '{"error":{"code":"UnknownError" "pbi.error":{"code":"UnknownError" "parameters":{} "details":[]}}}' Request ID: 1e6fe497-30b3-5707-42ca-285f1747a7ff.
15-04-2019 13:53Online Shoppers IntentFailedPurchase Intent Prediction Testing Data15-04-2019 13:5315-04-2019 13:53FailedError: One or more upstream operations failed... RootActivityId = 5d8a6495-df6f-425b-8dbd-8188366137d1 Request ID: 1e6fe497-30b3-5707-42ca-285f1747a7ff.
4 REPLIES 4
XY123
Regular Visitor

I'm having exactly the same issue. There seems to be an issue with the "AI.SampleStratifiedWithHoldout" function in the Power Query Editor. 

Anonymous
Not applicable

I've added a detaile error message, maybe it makes sense for someone:

 

DataSource.Error: An error happened while reading data from the provider: '{"error":{"code":"UnknownError","pbi.error":{"code":"UnknownError","parameters":{},"details":[]}}}'

 

section Section1;
shared #"Online Visitor" = let
  Source = Csv.Document(Web.Contents("https://raw.githubusercontent.com/santoshc1/PowerBI-AI-samples/master/Tutorial_AutomatedML/online_shoppers_intention.csv"), [Delimiter = ",", Columns = 18, QuoteStyle = QuoteStyle.None]),
  #"Promoted headers" = Table.PromoteHeaders(Source, [PromoteAllScalars = true]),
  #"Changed column type" = Table.TransformColumnTypes(#"Promoted headers", {{"Administrative_Duration", type number}, {"Informational_Duration", type number}, {"ProductRelated_Duration", type number}, {"BounceRates", type number}, {"ExitRates", type number}, {"PageValues", type number}, {"SpecialDay", type number}, {"Weekend", type logical}, {"Revenue", type logical}})
in
  #"Changed column type";
shared #"Purchase Intent Prediction Training Data" = let
  Source = #"Online Visitor",
  #"Selected columns" = Table.SelectColumns(Source, {"Administrative", "Administrative_Duration", "Informational", "Informational_Duration", "ProductRelated", "ProductRelated_Duration", "BounceRates", "ExitRates", "PageValues", "SpecialDay", "Month", "OperatingSystems", "Browser", "Region", "TrafficType", "VisitorType", "Weekend", "Revenue"}),
  #"Removed nulls" = Table.SelectRows(#"Selected columns", each [Revenue] <> null),
  #"Sampled input" = AI.SampleStratifiedWithHoldout("Revenue", Table.RowCount(#"Removed nulls"), #"Removed nulls")
in
  #"Sampled input";
shared #"Purchase Intent Prediction" = let
  Source = #"Purchase Intent Prediction Training Data",
  #"Invoked TrainPrediction" = AIInsights.Contents(){[Key = "AI.Execute"]}[Data]("AI.TrainPrediction", "Regular", [labelColumnName = "Revenue", data = Source]),
  #"Selected training schema columns" = Table.SelectColumns(#"Invoked TrainPrediction", {"TrainingId", "Model", "Stats", "GlobalExplanation", "TrainingSchema", "TrainingAUC", "LabelColumn"})
in
  #"Selected training schema columns";
shared #"Purchase Intent Prediction.Score" = let
  ApplyScoringFunction = (inputQuery as table, newColumn as text, decisionThreshold as number) => let
  MlModel = #"Purchase Intent Prediction",
  MlModelJson = try Text.FromBinary(Json.FromValue(MlModel{0})) otherwise "InvalidModel",
  Source = inputQuery,
  SelectedBaseEntityColumns = {"Administrative", "Administrative_Duration", "Informational", "Informational_Duration", "ProductRelated", "ProductRelated_Duration", "BounceRates", "ExitRates", "PageValues", "SpecialDay", "Month", "OperatingSystems", "Browser", "Region", "TrafficType", "VisitorType", "Weekend", "Revenue"},
  InputRowCount = Table.RowCount(Source),
  InputTableType = Value.Type(Source),
  SelectedColumnsTypes = List.Transform(SelectedBaseEntityColumns, each Type.TableColumn(InputTableType, _)),
  ScoringFunction = 
        let
            ScoringFunctionScalarType = type function (row as record) as any,
            VectorizedScoringFunction = (input as table) =>
              let
                ExpandedColumns = Table.ExpandRecordColumn(input, "row", SelectedBaseEntityColumns),
                ExpandedColumnsWithTypes = Table.TransformColumnTypes(ExpandedColumns, List.Zip({SelectedBaseEntityColumns, SelectedColumnsTypes})),
                ErrorList = List.Repeat({[Output = null]}, InputRowCount),
                Result = if MlModelJson <> "InvalidModel" then (try Table.ToRecords(AIInsights.Contents(){[Key = "AI.Execute"]}[Data]("AI.ScorePrediction", "Vectorized", [data = ExpandedColumns, scoreParameters = MlModelJson])) otherwise ErrorList) else ErrorList
              in
                Result,
            ScalarVectorScoringFunction = Function.ScalarVector(ScoringFunctionScalarType, VectorizedScoringFunction)
        in
            ScalarVectorScoringFunction,
  AddScoringColumn = Table.AddColumn(Source, newColumn, each ScoringFunction(_)),
  ExpandResultColumns = Table.ExpandRecordColumn(AddScoringColumn, newColumn, {"PredictionScore", "PredictionExplanation"}, {Text.Combine({newColumn, "PredictionScore"}, "."), Text.Combine({newColumn, "PredictionExplanation"}, ".")}),
  LabeledOutput = Table.AddColumn(ExpandResultColumns, Text.Combine({newColumn, "Outcome"}, "."), each Record.Field(_, Text.Combine({newColumn, "PredictionScore"}, ".")) >= decisionThreshold * 100),
  ReplacedErrors = Table.ReplaceErrorValues(LabeledOutput, {{Text.Combine({newColumn, "Outcome"}, "."), null}, {Text.Combine({newColumn, "PredictionScore"}, "."), null}, {Text.Combine({newColumn, "PredictionExplanation"}, "."), null}}),
  TransformTypes = Table.TransformColumnTypes(ReplacedErrors, {{Text.Combine({newColumn, "Outcome"}, "."), type logical}, {Text.Combine({newColumn, "PredictionScore"}, "."), type text}, {Text.Combine({newColumn, "PredictionExplanation"}, "."), type text}})
in
  TransformTypes
in
  ApplyScoringFunction;
shared #"Purchase Intent Prediction_PollingQuery" = let
  Source = "536eb714-1488-49b5-9ac6-598e40d1780b"
in
  Source;
shared #"Purchase Intent Prediction Testing Data" = let
  Source = #"Purchase Intent Prediction Training Data",
  #"Filtered rows" = Table.SelectRows(Source, each ([__IsTraining__] = false)),
  #"Invoked Scoring" = #"Purchase Intent Prediction.Score"(#"Filtered rows", "Purchase Intent PredictionOutput", 0.5)
in
  #"Invoked Scoring";
shared #"Purchase Intent Prediction Preview" = let
  Source = PowerBI.Dataflows(),
  Workspace = Source{[workspaceId = "94fe567d-5d7c-496c-85c7-30650d1271ce"]}[Data],
  Dataflow = Workspace{[dataflowId = "90099937-edac-4f34-8f73-3fca50551482"]}[Data],
  Preview = Dataflow{[entity = "Purchase Intent Prediction"]}[Data]
in
  Preview;
shared #"Purchase Intent Prediction Testing Data Preview" = let
  Source = PowerBI.Dataflows(),
  Workspace = Source{[workspaceId="94fe567d-5d7c-496c-85c7-30650d1271ce"]}[Data],
  Dataflow = Workspace{[dataflowId="90099937-edac-4f34-8f73-3fca50551482"]}[Data],
  Preview = Dataflow{[entity="Purchase Intent Prediction Testing Data"]}[Data]
in
  Preview;
Anonymous
Not applicable

Is it resolved?

Anonymous
Not applicable

Bump

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors