The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi all
I'm trying to set this up for a matrix visual following the documentation here: Customized data reduction but I can't seem to get it to work. I've updated my project to use API 5.2 and I've updated the capabilites file with the exact code from that page but the properties don't appear in the format pane. Does anyone have an example of this working?
Thanks
thanks for the reply @dm-p . Was your example purely capabilities.json changes or did you have to change anything in settings.ts, enumerateObjectInstances or the new formattingModel API?
Hi @saviourofdp,
I had to add a suitable class and properties to my visual settings that correspond to the capabilities (as has always been the way), otherwise these properties are not accessible to your VisualSettings class (or whatever name you have chosen for it). If your enumerateObjectInstances method has standard logic to populate the pane and you're not overriding your own containers too heavily, then there shouldn't be anything you need to do. However if you are doing this then it's going to depend on how you're building them.
If you're using the new formatting model (cards) that were introduced in API 5.1, you still need to add settings classes and properties - and the revised guide to the formatting pane still includes this step if you need to confirm what this should look like - but you won't need to use enumerateObjectInstances if using the new pane; I believe the new powerbi-visuals-utils-formattingmodel package takes care of that if you're using them. If not, then you will need to set up your own overridden getFormattingModel method in the Visual class that has your logic to return a valid FormattingModel.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Thanks for your help @dm-p . I've found that for a matrix to work, the relevant sections in the capabilities file needs to look like the following. In particular, the row algorithm needs to be set as window and columns algorithm needs to be set as something other than window. Otherwise, I see an error.
{
"dataRoles": [
{
"displayName": "Row Data",
"name": "rows",
"kind": "Grouping"
},
{
"displayName": "Column Data",
"name": "columns",
"kind": "Grouping"
},
{
"displayName": "Measure Data",
"name": "values",
"kind": "Measure"
}
],
"objects": {
"dataReductionCustomization": {
"properties": {
"columnCount": {
"type": {
"numeric": true
}
},
"rowCount": {
"type": {
"numeric": true
}
}
}
}
},
"privileges": [],
"dataViewMappings": [
{
"matrix": {
"dataVolume": 6,
"rows": {
"for": {
"in": "rows"
},
"dataReductionAlgorithm": {
"window": {
"count": 10
}
}
},
"columns": {
"for": {
"in": "columns"
},
"dataReductionAlgorithm": {
"sample": {
"count": 10
}
}
},
"values": {
"select": [
{
"for": {
"in": "values"
}
}
]
}
}
}
],
"dataReductionCustomization": {
"matrix": {
"columnCount": {
"defaultValue": 100,
"propertyIdentifier": {
"objectName": "dataReductionCustomization",
"propertyName": "columnCount"
}
},
"rowCount": {
"defaultValue": 100,
"propertyIdentifier": {
"objectName": "dataReductionCustomization",
"propertyName": "rowCount"
}
}
}
}
}
Hi @saviourofdp,
I have looked into it a little bit when it released and I found that I had to have my objects and properties named exactly as per the example, i.e. my object had to be named dataReductionCustomization, and (as I was using a categorical mapping), I had to name my property categoryCount (as per the schema definition here).
For instance, I was trying to add these to an existing object with a different name in my capabilities.json, and it wouldn't work, despite me updating the root dataReductionCustomization object to point to this revised object and property. Not sure if that's something you might have done?
This hard-coding of names wasn't acceptable for me, as I wanted to consolidate my properties, so I didn't keep my example, unfortunately, but it did work when everything was named as per the documentation.
Regards,
Daniel
Proud to be a Super User!
My course: Introduction to Developing Power BI Visuals
On how to ask a technical question, if you really want an answer (courtesy of SQLBI)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
3 | |
3 | |
3 | |
1 | |
1 |