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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
wellsayd
Frequent Visitor

Custom visual extract data from dataset

I have a column of 130 or so rows that contain either A,B,C,D,E,F ... When I try to access the 

table.rows, all of the duplicate rows have been grouped together with no indication of how many there are.
 
Preferably, I would like to access the data without PowerBi grouping the duplicates and allow me to do my own analysis in Typescript.
 
Any suggestions and thank you.
9 REPLIES 9
v-viig
Community Champion
Community Champion

Grouping is default behavior of Power BI.

The possible solution here is to add a Measure column to capabilities.json and put the main data column as Count of elements.

This solution will allow your custom visual to get how many items are there.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Thank you for your response. I am currently digging around for examples for what you are describing ... Currently, I have 

 

{
"dataRoles": [
  {
    "displayName": "Values",
    "name": "values",
    "kind": "Grouping"
  }
],
"dataViewMappings": [
 {
   "table": {
      "rows": {
         "for": {
            "in": "values"
          }
      }
    }
  }
 ]
}
 
Any suggestions would be much appreciated.


Ok I think I have what you are describing.

 

{
  "dataRoles": [
    {
            "displayName": "Category",
            "name": "Category",
            "kind": "Grouping"
        },
        {
            "displayName": "Values",
            "name": "Values",
            "kind": "Measure"
        }
  ],
  "dataViewMappings": [
      {

          "table": {
              "rows": {
                  "for": {
                      "in": "values"
                  }
              }
          }
      }
  ]
}



Then in the Values Field, select the drop down and select Count. See attached screen shot as a reference. 


example.jpg

Is there anyway to make the Count automatically occur?

 

Also, with the previous workflow ... all of the null or missing fields do not receive a count and it is part of the requirements.

 

Thank you for help !!

v-viig
Community Champion
Community Champion

As far as I know, there's no way to use Count by default.

 

Regarding null issue. It seems you should turn on "Shows items with no data":

 

image.png

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Thank you for the help.

 

The null value appears when you are just displaying the field.

 

But, the null value dissappears when you apply Count to the field.

 

Please see screenshots as a reference.

example1.jpgexample2.jpg

v-viig
Community Champion
Community Champion

Looks like it's limitation of categorical data view mapping.

We'd recommend that you should try table view mapping out.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

I am using table view mapping. 

v-viig
Community Champion
Community Champion

Power BI doesn't support Count aggregation for null values.

You might propose an idea to support Count for null values.

 

Ignat Vilesov,

Software Engineer

 

Microsoft Power BI Custom Visuals

pbicvsupport@microsoft.com

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.