microsoft / PowerBI-visuals-tools

Contains tools for building/packaging Power BI visuals
https://www.powerbi.com
MIT License
330 stars 149 forks source link

How to determine the aggregation type of a measure field in a Power BI custom visual #461

Closed rad10wave closed 11 months ago

rad10wave commented 1 year ago

I am using a measure field in my custom visual and want to display its aggregated value. However, when inspecting the dataview object, I noticed that the aggregates are always minLocal and maxLocal, and the queryName is always set to "Sum(...)" even when the user has selected a different aggregation type like average. Here's a screenshot of the dataview object for reference: image Here is measure from capabilities.json file:

{
      "name": "primaryMeasure",
      "kind": "Measure",
      "displayName": "Measure",
      "description": "Primary measure",
      "requiredTypes": [
        {
          "numeric": true
        }
      ]
    },

and I want to display the aggregated value of the measure in my visual. But in the dataview, the aggregates are always minLocal and maxLocal. even the queryName is always Sum(..., even if I select average:

I want to know if there's a way to programmatically determine the aggregation value for the measure field without relying on assumptions based on the displayName.

AleksSavelev commented 11 months ago

The issue isn't related to the Tools package. Feel free to contact pbicvsupport@microsoft.com with questions related to the development of custom visuals