Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Let's say I'm importing two separate tables of data into my custom visual, and these two tables have different column count and row count. Is is even possible to declare dataRoles and dataViewMappings for these two tables? I basically want to read all data in from both tables.
I tried the lines of code below in my capabilities.json, but Power BI Desktop just gave me the "Unexpected Error" dialog box:
"dataRoles": [
{
"displayName": "Foo",
"name": "foo",
"kind": 2
},
{
"displayName": "Bar",
"name": "bar",
"kind": 2
},
{
"displayName": "X",
"name": "x",
"kind": 2
},
{
"displayName": "Y",
"name": "y",
"kind": 2
},
{
"displayName": "Data",
"name": "data",
"kind": 2
}
],
"dataViewMappings": [
{
"conditions": [
{ "foo": { "max": 1 }, "bar": { "max": 1 } }
],
"table": {
"rows": {
"select": [
{ "for": { "in": "foo" } },
{ "for": { "in": "bar" } }
],
"dataReductionAlgorithm": { "top": { "count": 16000 } }
},
"rowCount": { "preferred": { "min": 2, "max": 16000 }, "supported": { "min": 1, "max": 20000 } }
}
},
{
"conditions": [
{ "x": { "max": 1 }, "y": { "max": 1 }, "data": { "max": 1 } }
],
"table": {
"rows": {
"select": [
{ "for": { "in": "x" } },
{ "for": { "in": "y" } },
{ "for": { "in": "data" } }
],
"dataReductionAlgorithm": { "sample": { "count": 30000 } }
},
"rowCount": { "preferred": { "min": 2, "max": 30000 }, "supported": { "min": 1, "max": 64000 } }
}
}
],
Any ideas? Thanks.
Has there been any progress on this issue in the 5 years since the original post?
I've tried adding multiple dataViews with no luck
Hi @Anonymous - no, it still isn't supported. I ask the team quite frequently for this, but there are no plans to address it (presumably because core visuals don't have these capabilities either and custom visuals APIs would need to build upon this).
Proud to be a Super User!
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Hi
It's such a shame! So much potential lost. I suggested three workarounds of that problem to my client, but they were unhappy with them. We'll see if the project starts at all. Without this limitation, over 100 users would benefit greatly from the custom visual.
As mentioned at https://github.com/Microsoft/PowerBI-visuals/blob/master/Capabilities/DataViewMappings.md, Each valid mapping will produce a DataView, but currently we only support performing one query per visual so in most situations you will only get one DataView. However, you can provide multiple data mappings with different conditions which allow. From my point of view, it is not supported yet.
So it appears that I only get one DataView, as you mentioned. I tried printing out the dataViews in the update(), and dataViews[0] was the only valid one. The rest were null.
Now 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. Besides, you could also reach out for help at GitHub.
@v-chuncz-msft - Version 1.2.0 actually broke my table. One of the columns in the table contains a text string in each row as data (a hyperlink to an image), and Power Bi Desktop now shows that column as a count instead of individual strings. There isn't an option to make it not a count. The only options in that field are: Remove field, Quick Calc, Count (Distinct), and Count. On the Modeling tab, Default Summarization is set to "Do Not Summarize". Any insights here? Thanks.
There are still a few limitations to using the PowerBI command line tools. Just keep a close eye on its progress.
@v-chuncz-msft - switching the dataRoles kind from "Measure" to "GroupingOrMeasure" in capabilities.json fixes my column count issue.
Thanks for sharing the information. We can see that the kind property has been changed.
"dataRole.kind": { "type": "string", "enum": [ "Grouping", "Measure", "GroupingOrMeasure" ] },
@v-chuncz-msft - Yes, the kind property has been changed in 1.2.0. We can no longer use a number to indicate a kind since it is now a string.
@v-chuncz-msft - Thanks. I took a look at v 1.2.0 but still didn't see anything that would allow me to import multiple tables. I only noticed the newly added "drilldown" property and "scriptResult" dataViewMapping.
Went ahead and updated to version 1.2.0. Power BI Desktop still crashed and burned when I tried to import in two tables (dataViews has a length of 0).
You mean that your orignal custom view works but it reported error after adding the following codes. Right? Maybe you can share the original code and updated code to do more diagnosis.
Yep, my original custom view works and produces one dataView. Original code is shown below:
"dataRoles": [
{
"displayName": "Foo",
"name": "foo",
"kind": 2
},
{
"displayName": "Bar",
"name": "bar",
"kind": 2
}
],
"dataViewMappings": [
{
"conditions": [
{ "foo": { "max": 1 }, "bar": { "max": 1 } }
],
"table": {
"rows": {
"select": [
{ "for": { "in": "foo" } },
{ "for": { "in": "bar" } }
],
"dataReductionAlgorithm": { "top": { "count": 16000 } }
},
"rowCount": { "preferred": { "min": 2, "max": 16000 }, "supported": { "min": 1, "max": 20000 } }
}
}
]
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
6 | |
6 | |
3 | |
2 | |
2 |