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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
blumi78
Helper I
Helper I

How To Multiple Data Contexts?

I want to display two (or more) charts in the same visual, that interact of some sort.

For this, I need two (or more) data contexts (Dimension->Measure).

How can I define the contents of capabilities.json that I can define many dimensions and many measures AND inside my code I see all the data values in update().

At the moment only the values of the first dimension are visible:

 

My capabilities.json

{
    "dataRoles": [
        {
            "displayName": "Dimension",
            "name": "category",
            "kind": "Grouping"
        },
        {
            "displayName": "Measure Data",
            "name": "measure",
            "kind": "Measure"
        }
    ],
    "dataViewMappings": [
        {
            "categorical": {
                "categories": {
                    "for": {
                        "in": "category"
                    },
                    "dataReductionAlgorithm": {
                        "top": {}
                    }
                },
                "values": {
                    "select": [
                        {
                            "bind": {
                                "to": "measure"
                            }
                        }
                    ]
                }
            }
        }
    ],
    "objects": {...}
}

Is there any online resource/tutorial about multiple data contexts available?

7 REPLIES 7
v-viig
Community Champion
Community Champion

Hello @blumi78

 

Power BI returns all of values.

Have you checked the prototype object? I think the values of the second category is in the prototype.

You might access value of second category by this code below:

 

// options: VisualUpdateOptions

options.dataViews[0].categorical.categories[1].values

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

@v-viig Thanks, I've found them! Do you have a solution for how to group them together? I want to make a (multi-)chart with N dimensions and M measures, where M >= N. So I need a mapping, which measure(s) relate to which dimension. I.e.:

 

dataviews[0].categorical.categories[0] => dataviews[0].categorical.values[0], dataviews[0].categorical.values[1]

dataviews[0].categorical.categories[1] => dataviews[0].categorical.values[2]

 

Do I need to make a custom GUI inside my extension for this or can this be done using the PowerBI sidebar somehow?

 

Thanks a lot!

Bastian

v-viig
Community Champion
Community Champion

I think there's no way to implement such behavior using Power BI sidebar.

In other words, you should implement your own GUI as did in Power KPI Matrix custom visual.

 

image.png

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Hello,

How could we implement a custom GUI? we couldnt find any data related to it in the documentation and as per the below thread the code for Power KPI is private
https://community.powerbi.com/t5/Custom-Visuals-Development/Power-KPI-Matrix-source-code-in-github/t...
Thanks,

You can use React or another library to build UI.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Which UI Library to use is not the problem, the problem is how to inject this UI to Power BI custom visual.

I suggest you start using our powerbi-visuals-tools@3.x.x.

 

It supports modern ES2015 import export and webpack. That means you can import almost any library and use it.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

 

 

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Top Kudoed Authors