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

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

Reply
Sundar1606
Helper I
Helper I

Matrix table view in Custom visuals.

I'm trying to build a custom visual, there i need the data like what we have in tables. I drag two column into "Summize Category"(Category name) and one column into "Measure Data". In dataview array contains categorical in that categories has multiple column. But values showing for only first category. Is there anything i need to tweak in dataviewmapping.

 

The following json structure is data roles and Data View Mappings 

 

{
  "dataRoles": [
    {
      "displayName": "Summize Category",
      "name": "myCategory",
      "kind": "Grouping"
    },
    {
      "displayName": "Measure Data",
      "name": "myMeasure",
      "kind": "Measure"
    }
  ],
  "dataViewMappings": [
    {
      "categorical": {
        "categories": {
          "for": {
            "in": "myCategory"
          },
          "dataReductionAlgorithm": {
            "top": {}
          }
        },
        "values": {
          "select": [
            {
              "bind": {
                "to": "myMeasure"
              }
            }
          ]
        }
      }
    }
  ]
}

 

Results of Data

"dataViews": [
    {
      "categorical": {
        "categories": {
          "0": {
            "source": {
              "roles": {
                "myCategory": true
              },
              "type": {
                "underlyingType": 1,
                "category": null
              },
              "displayName": "day",
              "queryName": "vthink_dev_database tipsData.day",
              "expr": {
                "_kind": 2,
                "source": {
                  "_kind": 0,
                  "entity": "vthink_dev_database tipsData"
                },
                "ref": "day"
              }
            },
            "values": [
              "Sun",
              "Sun",
              "Sun",
              "Sun",
              "Sun",
              "Sun",
              "Sun",
              "Sun",
              "Sun",
              "Sun",
              "Sun"
            ]
          },
          "1": {
            "source": {
              "roles": {
                "myCategory": true
              },
              "type": {
                "underlyingType": 260,
                "category": null
              },
              "format": "0",
              "displayName": "id",
              "queryName": "vthink_dev_database tipsData.id",
              "expr": {
                "_kind": 2,
                "source": {
                  "_kind": 0,
                  "entity": "vthink_dev_database tipsData"
                },
                "ref": "id"
              }
            }
          }
        }
      }
    }
  ]

 

1 REPLY 1
v-viig
Community Champion
Community Champion

I think it'd be better to use table or matrix data-mappings instead of categorical:

{
    "dataRoles": [
        {
            "displayName": "Summize Category",
            "name": "myCategory",
            "kind": "Grouping"
        },
        {
            "displayName": "Measure Data",
            "name": "myMeasure",
            "kind": "Measure"
        }
    ],
    "dataViewMappings": [
        {
            "table": {
                "rows": {
                    "select": [
                        {
                            "for": {
                                "in": "myCategory"
                            }
                        },
                        {
                            "for": {
                                "in": "myMeasure"
                            }
                        }
                    ]
                }
            }
        }
    ]
}

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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