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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mastone
Frequent Visitor

dataViewMappings for hierarchy summaries (custom visual)

I'm trying to develop my first power bi visual and struggling a bit.  I am not understanding how to get summary data at the hieararchy level.  

What I am attempting to do is get summary data at the parent level that summaries the data show in the bar charts.  You will notice that each level has 0% in the picture.  This is what I am trying to tackle and there will be up to 4 levels of hiearchy typically.

mastone_0-1709593011759.png

 

My data view mappings and data roles are below.   I have data that power bi hands the visual and is what was used to generate the image above....I would attach it but I don't see a way to attach the file and I can't paste it in as it's betwee 3500 and 52K lines long depending on the hierarchy level.

 

Any thoughts on what I can do to have power bi calculate the hiearchy levels just like the matrix does?  Here is a sample of similar data in the matrix visual (not my visual) that does the desired summary.

mastone_1-1709593434742.png

 

"dataRoles": [
        {
            "name": "Category",
            "displayName": "Category",
            "displayNameKey": "Visual_Category",
            "kind": "Grouping"
        },
        {
            "name": "Scored",
            "displayName": "Scored",
            "displayNameKey": "Visual_Scored",
            "kind": "Measure"
        },
        {
            "name": "ScorePercent",
            "displayName": "Score Percent",
            "displayNameKey": "Visual_ScorePercent",
            "kind": "Measure"
        }
    ],
 
 "dataViewMappings": [
        {
            "matrix": {
                "rows": {
                    "for": {
                        "in": "Category"
                    }
                },
                "values": {
                    "select": [
                        {
                            "for": {
                                "in": "Scored"
                            }
                        },
                        {
                            "for": {
                                "in": "ScorePercent"
                            }
                        }
                    ]
                }
            }
        }
    ],
 
 



1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @mastone,

 

All you can currently do is use the totals and subtotals API to request aggregated data, if using the matrix dataViewMapping. If you don't have this set up in your visual capabilities already, then I would suggest attempting to add it in as per the documentation.

 

If you have tried this, then there is currently no other way to aggregate the data view and you will need to contact Microsoft to request the feature you feel is missing.

 

Regards,

 

Daniel





Did I answer your question? Mark my post as a solution!

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)




View solution in original post

3 REPLIES 3
mastone
Frequent Visitor

@dm-p Thank you so much for pointing me in the right direction.  I took me quite a while to figure it out (I didn't understand the doucmentation initially)....but after some fiddling, I got everything to work.

 

mastone_0-1709672010258.png

Thanks again!

dm-p
Super User
Super User

Hi @mastone,

 

All you can currently do is use the totals and subtotals API to request aggregated data, if using the matrix dataViewMapping. If you don't have this set up in your visual capabilities already, then I would suggest attempting to add it in as per the documentation.

 

If you have tried this, then there is currently no other way to aggregate the data view and you will need to contact Microsoft to request the feature you feel is missing.

 

Regards,

 

Daniel





Did I answer your question? Mark my post as a solution!

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)




mastone
Frequent Visitor

Thank you dm-p!   I didn't even know that api existed.  This is very helpful.  I'll give that a shot.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.