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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Fromit87
Advocate I
Advocate I

Error: DirectQueryUnexpectedEndOfStream when combining a dataflow table with SAP BW

Hi there!

 

In my dataset I have table with a SAP BW message server connector source and second table loaded from a PowerPlatform Dataflow. In my usecase I need to combine data of these two tables (they are both import tables, not direct query tables).

 

So I setup the data merge within the dataflow table. My steps are: "Source", "Navigation". Then I setup the merge with the SAP table: "Merged Queries", and with the "Expand SAP_BW Profile" step I get the following error in Desktop:

 

Internal error DirectQueryUnexpectedEndOfStream.

 

When I combine the dataflow table with other sources, e.g. local files, other dataflows, etc. it works fine. The issue just appears when trying to merge data from SAP BW. Unfortunately, I can't load the SAP BW data in a dataflow, because dataflows don't support SSO.

 

Any ideas how to solve this? Can someone explain what the problem is? Thanks!

 

The complete error message including the detailed steps of the two tables is here:

 

Feedback Type:
Frown (Error)

Error Message:
Internal error DirectQueryUnexpectedEndOfStream.

Stack Trace:
Microsoft.Mashup.Host.Document.SerializedException
   at Microsoft.Mashup.Evaluator.EvaluationHost.OnException(IEngineHost engineHost, IMessageChannel channel, ExceptionMessage message)
   at Microsoft.Mashup.Evaluator.MessageHandlers.TryDispatch(IMessageChannel channel, Message message)
   at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
   at Microsoft.Mashup.Evaluator.ChannelMessenger.ChannelMessageHandlers.TryDispatch(IMessageChannel channel, Message message)
   at Microsoft.Mashup.Evaluator.MessageHandlers.Dispatch(IMessageChannel channel, Message message)
   at Microsoft.Mashup.Evaluator.Interface.IMessageChannelExtensions.WaitFor[T](IMessageChannel channel)
   at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.PreviewValueSource.WaitFor(Func`1 condition, Boolean disposing)
   at Microsoft.Mashup.Evaluator.RemotePreviewValueSource.PreviewValueSource.get_SmallValue()
   at Microsoft.Mashup.Evaluator.Interface.TracingPreviewValueSource.get_SmallValue()
   at Microsoft.Mashup.Host.Document.Analysis.PackageDocumentAnalysisInfo.PackagePartitionAnalysisInfo.SetPreviewValue(EvaluationResult2`1 result, Func`1 getStaleSince, Func`1 getSampled)

Stack Trace Message:
Internal error DirectQueryUnexpectedEndOfStream.

Invocation Stack Trace:
   at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
   at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
   at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.GetStackTraceInfo(Exception e)
   at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.ReportException(IWindowHandle activeWindow, IUIHost uiHost, FeedbackPackageInfo feedbackPackageInfo, Exception e, Boolean useGDICapture)
   at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.<>c__DisplayClass14_0.<HandleException>b__0()
   at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.HandleException(Exception e)
   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
   at Microsoft.PowerBI.Client.Program.<>c__DisplayClass4_1.<Main>b__3()
   at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
   at Microsoft.PowerBI.Client.Program.Main(String[] args)


PowerBINonFatalError:
{"AppName":"PBIDesktop","AppVersion":"2.111.590.0","ModuleName":"","Component":"Microsoft.Mashup.Evaluator.EvaluationHost","Error":"Microsoft.Mashup.Host.Document.SerializedException - Microsoft.Mashup.Host.Document.Evaluation.ErrorEvaluationResult","MethodDef":"OnException","ErrorOffset":""}

Snapshot Trace Logs:
C:\Users\xxxxx\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot49679e7a-2e83-47eb-bdb9-20331d6b28e4.zip

Model Default Mode:
Import

Model Version:
PowerBI_V3

Performance Trace Logs:
C:\Users\xxxxx\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_azureMapVisual
PBI_enhancedTooltips
PBI_enableWebView2
PQ_WebView2Connector
PBI_sparklines
PBI_scorecardVisual
PBI_fieldParametersSuperSwitch
PBI_relationshipEditPane

Disabled Preview Features:
PBI_SpanishLinguisticsEnabled
PBI_qnaLiveConnect
PBI_compositeModelsOverAS
PBI_b2bExternalDatasetSharing
PBI_NlToDax
PBI_horizontalFusion
PBI_optimizeTabRibbon

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

PowerBINonFatalError_ErrorDescription:
Microsoft.Mashup.Host.Document.Evaluation.ErrorEvaluationResult

PowerBIUserFeedbackServices_IsReported:
True

Formulas:


section Section1;

shared FACT_R2_AT_Sales = let
        Source = PowerPlatform.Dataflows(null),
    Workspaces = Source{[Id="Workspaces"]}[Data],
    #"5af2d5e6-38ba-412a-a7e4-76adf794044b" = Workspaces{[workspaceId="5af2d5e6-38ba-412a-a7e4-76adf794044b"]}[Data],
    #"750f0ac5-d34f-42f6-8ee1-93509afc708c" = #"5af2d5e6-38ba-412a-a7e4-76adf794044b"{[dataflowId="750f0ac5-d34f-42f6-8ee1-93509afc708c"]}[Data],
    FACT_R2_AT_Sales = #"750f0ac5-d34f-42f6-8ee1-93509afc708c"{[entity="FACT_R2_AT_Sales",version=""]}[Data],
    #"Merged Queries" = Table.NestedJoin(FACT_R2_AT_Sales, {"PIN_17_NUM"}, SAPBW_Profile, {"Serial Number"}, "SAPBW_Profile", JoinKind.LeftOuter),
    #"Expanded SAPBW_Profile" = Table.ExpandTableColumn(#"Merged Queries", "SAPBW_Profile", {"ent_id"}, {"ent_id"})
in
    #"Expanded SAPBW_Profile";

shared SAPBW_Profile = let
    Source = SapBusinessWarehouse.Cubes("bwprod.dx.deere.com", "PBW", "410", "PBW_GROUP", [Implementation="2.0", LanguageCode="EN"]),
    A2SD_M120 = Source{[Name="A2SD_M120"]}[Data],
    #"A2SD_M120/A2_SD_A2SD_M120_ZZ_007" = A2SD_M120{[Id="A2SD_M120/A2_SD_A2SD_M120_ZZ_007"]}[Data],
    #"Added Items" = Cube.Transform(#"A2SD_M120/A2_SD_A2SD_M120_ZZ_007",
        {
            {Cube.ApplyParameter, "[A2CURVAR]", {3}},
            {Cube.AddMeasureColumn, "Quantity", "[Measures].[4TJTA7XEPPEDOG4T3V5X5EPDH]"},
            {Cube.ApplyParameter, "[A2MTFERT]", {{"[0MATERIAL__0MATL_TYPE].[FERT]"}}},
            {Cube.ApplyParameter, "[A2_ACTST]", {{"[ACCT_STAT].[C]"}}},
            {Cube.ApplyParameter, "[A2_DISCH]", {{"[0DISTR_CHAN].[10]"}}},
            {Cube.ApplyParameter, "[A2_SORG]", {{"[0DOC_NUMBER__0SALESORG].[2200]"}}},
            {Cube.AddAndExpandDimensionColumn, "[0EQUIPMENT]", {"[0EQUIPMENT].[LEVEL01]"}, {"Equipment Number.Equipment Number Level 01"}},
            {Table.AddColumn, "Equipment Number.Equipment Number Level 01.Profile Number CGMDP (Key)", each Cube.AttributeMemberProperty([Equipment Number.Equipment Number Level 01], "[2A2_PRONUM]")},
            {Cube.AddAndExpandDimensionColumn, "[4A2SD_M120-ERTLSDATE]", {"[4A2SD_M120-ERTLSDATE].[LEVEL01]"}, {"Retail Sold Date.Retail Sold Date Level 01"}},
            {Cube.AddAndExpandDimensionColumn, "[4A2SD_M120-ESERIALNUM]", {"[4A2SD_M120-ESERIALNUM].[LEVEL01]"}, {"Serial Number.Serial Number Level 01"}},
            {Cube.AddAndExpandDimensionColumn, "[0COMP_CODE]", {"[0COMP_CODE].[LEVEL01]"}, {"Company code.Company code Level 01"}},
            {Cube.ApplyParameter, "[A2OFORD]", {{}}},
            {Cube.ApplyParameter, "[SO_RSDT]", {{}}}
        }),
    #"Removed Columns" = Table.RemoveColumns(#"Added Items",{"Quantity", "Equipment Number.Equipment Number Level 01", "Company code.Company code Level 01"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Retail Sold Date.Retail Sold Date Level 01", type date}}, "en-US"),
    #"Removed Errors" = Table.RemoveRowsWithErrors(#"Changed Type", {"Equipment Number.Equipment Number Level 01.Profile Number CGMDP (Key)", "Retail Sold Date.Retail Sold Date Level 01", "Serial Number.Serial Number Level 01"}),
    #"Filtered Rows" = Table.SelectRows(#"Removed Errors", each [Retail Sold Date.Retail Sold Date Level 01] >= #date(2018, 11, 1)),
    #"Filtered Rows1" = Table.SelectRows(#"Filtered Rows", each [#"Equipment Number.Equipment Number Level 01.Profile Number CGMDP (Key)"] <> "111111111" and [#"Equipment Number.Equipment Number Level 01.Profile Number CGMDP (Key)"] <> "9999999" and [#"Equipment Number.Equipment Number Level 01.Profile Number CGMDP (Key)"] <> "1111111111"),
    #"Renamed Columns" = Table.RenameColumns(#"Filtered Rows1",{{"Equipment Number.Equipment Number Level 01.Profile Number CGMDP (Key)", "Profile Number"}, {"Retail Sold Date.Retail Sold Date Level 01", "Retail Sold Date"}, {"Serial Number.Serial Number Level 01", "Serial Number"}})
in
    #"Renamed Columns";

 

 

 

 

 

4 REPLIES 4
johnst101
Regular Visitor

Hello,

 

I am having a similar issue even merging two dataflows together in Power Query and getting Internal error DirectQueryUnexpectedEndOfStream. I also need the merge to happen within Power Query. 

 

Please let me know if you were able to fix your issue or if someone has a solution to this issue. There is no clear reason as to why this merge isn't working properly.

Fromit87
Advocate I
Advocate I

Hi @lbendlin thank you for your suggestion. Unfortunately in this usecase it is vital to merge the sources in PQ, rather than building a relationship in the data model.

Sory to hear that. You can raise an issue at https://issues.powerbi.com . If you have a Pro license you can consider raising a Pro ticket at https://powerbi.microsoft.com/en-us/support/pro/

lbendlin
Super User
Super User

Do you have to merge the data sources in Power Query or can you join them in the Power BI data model instead?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.