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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
soeren
New Member

PowerBI custom visual dataView matrix valueSource is empty

I am currently trying to port a PowerBI visual from API Version 1.0.0 to Version 1.1.0.

I am creating a Visual with a matrix as a dataView. To this point my Visual works. But when I try to check if a have a valueSource for my matrix, I get returned by calling console.error(dataView.matrix.valueSources.length = 0), that: dataView.matrix.valueSources.length = 0.

In a converter Method, I'm trying to iterate over my valueSources and for each valueSource I try call addTreeChildrenValues() and then push my columns.

 

public update(options: powerbi.extensibility.visual.VisualUpdateOptions) {
var dataView = this.dataView = options.dataViews[0];
var viewModel: FormattedColumnsViewModel = FormattedColumnsVisual.converter(dataView);
...
}


public static converter(dataView: DataView): FormattedColumnsViewModel {
for (var i = 0; i < dataView.matrix.valueSources.length; i++) {
FormattedColumnsVisual.addTreeChildrenValues(values, dataView.matrix.rows.root.children, i); columns.push({ headerCaption: dataView.matrix.valueSources[i].displayName, values: values, formatOption: formatOption, showNumbers: showNumbers, width: width, leftMargin: leftMargin, usableWidth: usableWidth, fullRange: fullRange, zeroPosition: zeroPosition, formatter: formatter }); }

My question is:

  1. Why is valueSources of dataView.matrix empty?
  2. Does it have something to do with my capabilities.json file?

Capabalities.json (part of it):

  {
  "dataRoles": [
    {
      "name": "Category",
      "kind": 0,
      "displayName": "Category"

    },
    {
      "name": "Column",
      "kind": 1,
      "displayName": "Value" 
    }
  ],
  "dataViewMappings": [
    {
      "matrix": {
        "rows": {
          "select": [ { "for": { "in": "Category" } } ],
          "dataReductionAlgorithm": { "top": { } }
        },
        "values": {
          "for": {"in": "Column"} 
        }
      }
    }
  ]

 

1 REPLY 1
v-chuncz-msft
Community Support
Community Support

@soeren,

 

The default API version for new visuals has been changed to 1.2.0. You may check the capabilities JSON schema at https://github.com/Microsoft/PowerBI-visuals-tools/blob/master/templates/visuals/.api/v1.2.0/schema..... For tips about debugging your custom visual, see the debugging guide.

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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