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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Getting aggregation value in matrix data mapping

Hi all ! 

By using the matrix data mapping with the capabilities as below : 

 

 

 

    "dataRoles": [
                {
            "name": "timedimension",
            "displayName": "Time Dimension",
            "displayNameKey": "Visual_Category",
            "kind": "Grouping"
        },
        {
            "name": "dimension",
            "displayName": "Dimension",
            "displayNameKey": "Visual_Dimension",
            "kind": "Grouping"
        },
        {
            "name": "measure",
            "displayName": "Measure",
            "displayNameKey": "Visual_Values",
            "kind": "Measure"
        }
    ],
    ...
    "dataViewMappings": [
        {
            "matrix": {
                "rows": {
                    "for": {
                        "in": "timedimension"
                    },
                    "root": {
                        "children": [
                            {
                                "level": 0,
                                "value": "Year",
                                "children": [
                                    {
                                        "level": 1,
                                        "value": "Quarter",
                                        "children": [
                                            {
                                                "level": 2,
                                                "value": "Month",
                                                "children": [
                                                    {
                                                        "level": 3,
                                                        "value": "Day",
                                                        "values": {
                                                            "0": {
                                                                "value": "measure"
                                                            }
                                                        }
                                                    }
                                                ]
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                },
                "columns": {
                    "root": {
                        "children": [
                            {
                                "level": 0,
                                "value": "dimension"
                            }
                        ]
                    }
                },
                "values": {
                    "select": [
                        {
                            "bind": {
                                "to": "measure"
                            }
                        }
                    ]
                }
            }
        }
    ]

 

 

 

I am getting the values just for the leaves of my hierarchy as below : 

turgayseop_0-1618421879125.png

But, I need to get the aggregation values for the parent members of the hierarchy (Month/Quarter/Year) .

 

Any comments & helps to figure it out is welcome  !

 

Thanks in advance ! 

3 REPLIES 3
Anonymous
Not applicable

Hi @dm-p ! about this maybe you could catch a mistake or have an opinion ? You can find some more details at the post that i have replied here in same topic.. Thanks in Advance ‌‌!

Anonymous
Not applicable

Hi @V-lianl-msft  thanks for answering !

 

Well , the configuration i have shared is already done guiding by the documentation that you have shared.

 

I will make some highlights of the changes that I applied upon the reference to point out better the situation,

 

So in the documentation the last child of the "row" attribute which include the value properties:

 

 

"children": [
		{
			"level": 2,
			...
			"value": "Grandchild1",
			"identity": {...},
			"values": {
				"0": {
					"value": 5 // value for Col1
				},
				"1": {
					"value": 6 // value for Col2
				}
			}
		},

 

 

So , here the values (5,6) are placed in our case will be obtained from the "measure" data type, so it is mapped as : 

 

 

"children": [
		{
			"level": 3,
			"value": "Day",
			"values": {
				"0": {
					"value": "measure"
				}
			}
		}
	]

 

 

and for the "columns" the "value" is changed as "dimension" in my configuration to get the value for each column name from "dimension" data type ,

documentation : 

 

 

"columns": {
            "levels": [...],
            "root": {
                ...
                "children": [
                    {
                        "level": 0,
                        "levelValues": [...],
                        "value": "Col1",
                        "identity": {...}
                    },

 

 

 

my configuration : 

 

 

"columns": {
                "for": {
                   "in": "dimension"
                },
		"root": {
			"children": [
				{
					"level": 0,
					"value": "dimension"
				}
			]
		}
	},

 

 

 

Here one last difference is that I have placed the for:in  attribute (it is mandatory).

 

So, depending on this, if you have any specific suggestion please do not hesitate to share.. 

I will be looking forward for any answer, thanks in advance! 

V-lianl-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please refer to the document:

https://docs.microsoft.com/en-us/power-bi/developer/visuals/dataview-mappings 

 

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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