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
Anonymous
Not applicable

Custom Visual: PBI Desktop throws "An error occurred while rendering the report" error and freezes

I am developing a Power BI Custom Visual (Line Chart) which appears to work fine whilst developing in PBI online (no console errors, etc.) however when I package the visual and attempt to use it in PBI Desktop, I get a "An error occurred while rendering the report" error upon adding X Axis or Y Axis fields. PBI Desktop then feeezes.

 

I've viewed the full details of the error (see below) and nothing jumps out to me as the root cause.

 

Is there a known fix to this? Or is there any way I can debug my visual in order to further diagnose the issue?

Thanks in advance!

 

Spoiler
Feedback Type:
Frown (Error)

Error Message:
An error occurred while rendering the report.

Stack Trace:
(at TypeError: Cannot read property 'index' of undefined
    at filterVariantMeasuresTable (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:11288:45)
    at filterVariantMeasures (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:11219:43)
    at Object.apply (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:11210:17)
    at transformDataView (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:13597:48)
    at transformQueryToVisualDataView (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:13565:66)
    at Object.apply (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:13540:447)
    at VisualComponentCore.transformAndValidateDataViews (ms-pbi://pbi.microsoft.com/minerva/scripts/VisualHostUI.js:667:73)
    at VisualComponentCore.<anonymous> (ms-pbi://pbi.microsoft.com/minerva/scripts/VisualHostUI.js:780:59)
    at step (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:153:23)
    at Object.next (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:105:20):line:null:)
TypeError: Cannot read property 'index' of undefined
    at filterVariantMeasuresTable (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:11288:45)
    at filterVariantMeasures (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:11219:43)
    at Object.apply (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:11210:17)
    at transformDataView (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:13597:48)
    at transformQueryToVisualDataView (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:13565:66)
    at Object.apply (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:13540:447)
    at VisualComponentCore.transformAndValidateDataViews (ms-pbi://pbi.microsoft.com/minerva/scripts/VisualHostUI.js:667:73)
    at VisualComponentCore.<anonymous> (ms-pbi://pbi.microsoft.com/minerva/scripts/VisualHostUI.js:780:59)
    at step (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:153:23)
    at Object.next (ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js:105:20)

Stack Trace Message:
An error occurred while rendering the report.

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__DisplayClass15_0.<HandleException>b__0()
   at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass0_1.<SendAndMarshalExceptions>b__0(Object null)
   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_0.<Main>b__1()
   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)


JS Error Message:
Cannot read property 'index' of undefined

PowerBINonFatalError:
{"AppName":"PBIDesktop","AppVersion":"2.87.1061.0","ModuleName":"ms-pbi://pbi.microsoft.com/minerva/scripts/visuals.js","Component":"","Error":"TypeError","MethodDef":"filterVariantMeasuresTable","ErrorOffset":"11288:45"}

AS Live Connection:
True

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

Enabled Preview Features:
PBI_NewWebTableInference
PBI_v3ModelsPreview

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
PBI_JsonTableInference
PBI_ImportTextByExample
PBI_ExcelTableInference
PBI_qnaLiveConnect
PBI_azureMapVisual
PBI_dataPointLassoSelect
PBI_narrativeTextBox
PBI_dynamicParameters
PBI_anomalyDetection
PBI_newFieldList

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

Recent Actions:
DeleteCustomVisual, AddEmptyVisualContainer, VisualContainerUpdateDimensions, AddFieldInRole

PowerBIUserFeedbackServices_IsReported:
True

Formulas:


section Section1;

Active Section Contract:
{"name":"ReportSectionc50a358c00da002a6da5","displayName":"Custom Visual","filters":"[]","ordinal":1,"visualContainers":[{"x":1021.0526315789474,"y":0,"z":0,"width":258.9473684210526,"height":150.6766917293233,"config":{"name":"d4770cd8cb73061795c0","layouts":[{"id":0,"position":{"x":1021.0526315789474,"y":0,"z":0,"width":258.9473684210526,"height":150.6766917293233}}],"singleVisual":{"visualType":"slicer","projections":{"Values":[{"queryRef":"Date.Calendar Date","active":true}]},"prototypeQuery":{"Version":2,"From":[{"Name":"d","Entity":"Date","Type":0}],"Select":[{"Column":{"Expression":{"SourceRef":{"Source":"d"}},"Property":"Calendar Date"},"Name":"Date.Calendar Date"}],"OrderBy":[{"Direction":1,"Expression":{"Column":{"Expression":{"SourceRef":{"Source":"d"}},"Property":"Calendar Date"}}}]},"drillFilterOtherVisuals":true,"hasDefaultSort":true,"objects":{"data":[{"properties":{"startDate":{"expr":{"Literal":{"Value":"datetime'2020-01-01T00:00:00'"}}},"mode":{"expr":{"Literal":{"Value":"'Between'"}}}}}],"header":[{"properties":{"show":{"expr":{"Literal":{"Value":"true"}}}}}],"dateRange":[{"properties":{"includeToday":{"expr":{"Literal":{"Value":"true"}}}}}],"general":[{"properties":{"filter":{"filter":{"Version":2,"From":[{"Name":"d","Entity":"Date","Type":0}],"Where":[{"Condition":{"Comparison":{"ComparisonKind":2,"Left":{"Column":{"Expression":{"SourceRef":{"Source":"d"}},"Property":"Calendar Date"}},"Right":{"Literal":{"Value":"datetime'2020-01-01T00:00:00'"}}}}}]}}}}]},"vcObjects":{"background":[{"properties":{"show":{"expr":{"Literal":{"Value":"false"}}}}}]}}},"filters":"[]"},{"x":1021.3533834586466,"y":98.34586466165413,"z":1000,"width":258.9473684210526,"height":291.4285714285714,"config":{"name":"40dea75dec3e39bc01a0","layouts":[{"id":0,"position":{"x":1021.3533834586466,"y":98.34586466165413,"z":1000,"width":258.9473684210526,"height":291.4285714285714}}],"singleVisual":{"visualType":"slicer","projections":{"Values":[{"queryRef":"Operating Entity.Operating Hierarchy.Business Unit Name","active":true},{"queryRef":"Operating Entity.Operating Hierarchy.Site Name","active":true}]},"prototypeQuery":{"Version":2,"From":[{"Name":"o","Entity":"Operating Entity","Type":0}],"Select":[{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"o"}},"Hierarchy":"Operating Hierarchy"}},"Level":"Business Unit Name"},"Name":"Operating Entity.Operating Hierarchy.Business Unit Name"},{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"o"}},"Hierarchy":"Operating Hierarchy"}},"Level":"Site Name"},"Name":"Operating Entity.Operating Hierarchy.Site Name"}]},"expansionStates":[{"roles":["Values"],"levels":[{"queryRefs":["Operating Entity.Operating Hierarchy.Business Unit Name"],"isCollapsed":true,"identityKeys":[{"Column":{"Expression":{"SourceRef":{"Entity":"Operating Entity"}},"Property":"Business Unit Name"}}],"isPinned":true},{"queryRefs":["Operating Entity.Operating Hierarchy.Site Name"],"isCollapsed":true,"isPinned":true}],"root":{"identityValues":null,"children":[{"identityValues":[{"Literal":{"Value":"'Kumba Iron Ore'"}}],"isToggled":true}]}}],"drillFilterOtherVisuals":true,"objects":{"data":[{"properties":{"mode":{"expr":{"Literal":{"Value":"'Basic'"}}}}}],"header":[{"properties":{"show":{"expr":{"Literal":{"Value":"true"}}},"text":{"expr":{"Literal":{"Value":"'Org. Hierarcy'"}}}}}],"general":[{"properties":{"filter":{"filter":{"Version":2,"From":[{"Name":"o","Entity":"Operating Entity","Type":0}],"Where":[{"Condition":{"In":{"Expressions":[{"Column":{"Expression":{"SourceRef":{"Source":"o"}},"Property":"Business Unit Name"}},{"Column":{"Expression":{"SourceRef":{"Source":"o"}},"Property":"Site Name"}}],"Values":[[{"Literal":{"Value":"'Kumba Iron Ore'"}},{"Literal":{"Value":"'Sishen'"}}]]}}}]}}}}],"selection":[{"properties":{"singleSelect":{"expr":{"Literal":{"Value":"false"}}}}}]},"vcObjects":{"background":[{"properties":{"show":{"expr":{"Literal":{"Value":"false"}}}}}]},"filterExpressionMetadata":{"expressions":[{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Entity":"Operating Entity"}},"Hierarchy":"Operating Hierarchy"}},"Level":"Business Unit Name"}},{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Entity":"Operating Entity"}},"Hierarchy":"Operating Hierarchy"}},"Level":"Site Name"}}],"cachedValueItems":[{"identities":[{"scopeId":{"Comparison":{"ComparisonKind":0,"Left":{"Column":{"Expression":{"SourceRef":{"Entity":"Operating Entity"}},"Property":"Business Unit Name"}},"Right":{"Literal":{"Value":"'Kumba Iron Ore'"}}}}},{"scopeId":{"Comparison":{"ComparisonKind":0,"Left":{"Column":{"Expression":{"SourceRef":{"Entity":"Operating Entity"}},"Property":"Site Name"}},"Right":{"Literal":{"Value":"'Sishen'"}}}}}],"valueMap":{"0":"Kumba Iron Ore","1":"Sishen"}}]}}},"filters":"[]"},{"x":1022.2556390977443,"y":389.77443609022555,"z":2000,"width":258.04511278195486,"height":89.32330827067669,"config":{"name":"5e2f40fa43827c400dd7","layouts":[{"id":0,"position":{"x":1022.2556390977443,"y":389.77443609022555,"z":2000,"width":258.04511278195486,"height":89.32330827067669}}],"singleVisual":{"visualType":"slicer","projections":{"Values":[{"queryRef":"Material.Material Type","active":true}]},"prototypeQuery":{"Version":2,"From":[{"Name":"m","Entity":"Material","Type":0}],"Select":[{"Column":{"Expression":{"SourceRef":{"Source":"m"}},"Property":"Material Type"},"Name":"Material.Material Type"}]},"drillFilterOtherVisuals":true,"objects":{"data":[{"properties":{"mode":{"expr":{"Literal":{"Value":"'Basic'"}}}}}],"general":[{"properties":{}}]}}},"filters":"[]"},{"x":1021.3533834586466,"y":479.09774436090225,"z":3000,"width":258.9473684210526,"height":240.90225563909775,"config":{"name":"2869de8349170e720030","layouts":[{"id":0,"position":{"x":1021.3533834586466,"y":479.09774436090225,"z":3000,"width":258.9473684210526,"height":240.90225563909775}}],"singleVisual":{"visualType":"slicer","projections":{"Values":[{"queryRef":"Equipment.Equipment Hierarchy.Equipment Type Description","active":true},{"queryRef":"Equipment.Equipment Hierarchy.Equipment Fleet Code"},{"queryRef":"Equipment.Equipment Hierarchy.Plant No"}]},"prototypeQuery":{"Version":2,"From":[{"Name":"e","Entity":"Equipment","Type":0}],"Select":[{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"e"}},"Hierarchy":"Equipment Hierarchy"}},"Level":"Equipment Type Description"},"Name":"Equipment.Equipment Hierarchy.Equipment Type Description"},{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"e"}},"Hierarchy":"Equipment Hierarchy"}},"Level":"Equipment Fleet Code"},"Name":"Equipment.Equipment Hierarchy.Equipment Fleet Code"},{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"e"}},"Hierarchy":"Equipment Hierarchy"}},"Level":"Plant No"},"Name":"Equipment.Equipment Hierarchy.Plant No"}]},"expansionStates":[{"roles":["Values"],"levels":[{"queryRefs":["Equipment.Equipment Hierarchy.Equipment Type Description"],"isCollapsed":true,"identityKeys":[{"Column":{"Expression":{"SourceRef":{"Entity":"Equipment"}},"Property":"Equipment Type Description"}}],"isPinned":true},{"queryRefs":["Equipment.Equipment Hierarchy.Equipment Fleet Code"],"isCollapsed":true,"identityKeys":[{"Column":{"Expression":{"SourceRef":{"Entity":"Equipment"}},"Property":"Equipment Fleet Code"}}],"isPinned":true},{"queryRefs":["Equipment.Equipment Hierarchy.Plant No"],"isCollapsed":true,"isPinned":true}],"root":{"identityValues":null,"children":[{"identityValues":[{"Literal":{"Value":"'Dump Truck'"}}],"children":[{"identityValues":[{"Literal":{"Value":"'Unknown'"}}],"isToggled":true}]},{"identityValues":[{"Literal":{"Value":"'Lhd'"}}],"children":[{"identityValues":[{"Literal":{"Value":"'Unknown'"}}],"isToggled":true}]}]}}],"drillFilterOtherVisuals":true,"objects":{"data":[{"properties":{"mode":{"expr":{"Literal":{"Value":"'Basic'"}}}}}],"header":[{"properties":{"text":{"expr":{"Literal":{"Value":"'Equipment'"}}}}}],"general":[{"properties":{}}]}}},"filters":"[]"},{"x":1008.7218045112782,"y":0,"z":4000,"width":12.631578947368421,"height":720,"config":{"name":"6654aaa95dd7e8ac65a2","layouts":[{"id":0,"position":{"x":1008.7218045112782,"y":0,"z":4000,"width":12.631578947368421,"height":720}}],"singleVisual":{"visualType":"basicShape","drillFilterOtherVisuals":true,"objects":{"general":[{"properties":{"shapeType":{"expr":{"Literal":{"Value":"'line'"}}}}}],"line":[{"properties":{"lineColor":{"solid":{"color":{"expr":{"Literal":{"Value":"'#000049'"}}}}},"weight":{"expr":{"Literal":{"Value":"2D"}}}}}]}}},"filters":"[]"},{"x":6.315789473684211,"y":0,"z":4001,"width":860.7518796992481,"height":720,"config":{"name":"16abc55c5ad465f73494","layouts":[{"id":0,"position":{"x":6.315789473684211,"y":0,"z":4001,"width":860.7518796992481,"height":720}}],"singleVisual":{"visualType":"line0177D5A8C4B2CA4EAA896FE7591D3E7288","projections":{"xAxisDate":[{"queryRef":"Date.Calendar YMD.Year","active":true},{"queryRef":"Date.Calendar YMD.Month"},{"queryRef":"Date.Calendar YMD.Date"}]},"prototypeQuery":{"Version":2,"From":[{"Name":"d","Entity":"Date","Type":0}],"Select":[{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"d"}},"Hierarchy":"Calendar YMD"}},"Level":"Year"},"Name":"Date.Calendar YMD.Year"},{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"d"}},"Hierarchy":"Calendar YMD"}},"Level":"Month"},"Name":"Date.Calendar YMD.Month"},{"HierarchyLevel":{"Expression":{"Hierarchy":{"Expression":{"SourceRef":{"Source":"d"}},"Hierarchy":"Calendar YMD"}},"Level":"Date"},"Name":"Date.Calendar YMD.Date"}]},"drillFilterOtherVisuals":true}},"filters":"[]"}],"config":{},"displayOption":1,"width":1280,"height":720}

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

OK, I managed to solve it by removing the "requiredTypes" code from my dataRoles!

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

OK, I managed to solve it by removing the "requiredTypes" code from my dataRoles!

 

Anonymous
Not applicable

OK, I think I have narrowed down the problem a little. For my dataViewMappings I am using the table mapping. I've discovered that I only get this error when I add a hierarchical into the Grouping value. I'll attempt to explain this with the following information.

 

These are my dataRoles, dataViewMappings & drilldown:

 

 

{
  "dataRoles": [
    {
      "displayName": "X Axis (Date)",
      "name": "xAxisDate",
      "kind": "Grouping"
    },
    {
      "displayName": "Y Axis (Value)",
      "name": "yAxisValue",
      "kind": "Measure",
      "requiredTypes": [
        {
          "numeric": true
        },
        {
          "integer": true
        }
      ]
    }
  ],
  "dataViewMappings": [
    {
      "table": {
        "rows": {
          "select": [
            {
              "for": {
                "in": "xAxisDate"
              }
            },
            {
              "for": {
                "in": "yAxisValue"
              }
            }
          ],
          "dataReductionAlgorithm": {
            "top": {
              "count": 1000
            }
          }
        }
      }
    }
  ],
  "drilldown": {
    "roles": [
      "xAxisDate"
    ]
  }
}

 

 

The pbiviz packages fine, however when I drag a date hierarchy onto the X Axis Grouping like so:

err_1.PNG

 

Then I get this error in PBI Desktop:

err_2.PNG

 

This is what my date hierarchy values look like:

err_3.PNG

 

Any ideas what the problem may be? My version of Power BI Desktop is Version: 2.87.1061.0 64-bit (November 2020)

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.