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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.