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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Master_T
Helper I
Helper I

Get all columns in custom visual

I'm trying to build a custom pivot table visual for PowerBI, and to do that I'm using the "matrix" dataview mapping, like this:

 

 

"dataRoles": [
        {
            "name": "Category",
            "displayName": "Category",
            "displayNameKey": "Visual_Category",
            "kind": "Grouping"
        },
        {
            "name": "Column",
            "displayName": "Column",
            "displayNameKey": "Visual_Column",
            "kind": "Grouping"
        },
        {
            "name": "Measure",
            "displayName": "Measure",
            "displayNameKey": "Visual_Values",
            "kind": "Measure"
        }
    ],
    "dataViewMappings": [
        {
            "matrix": {
                "rows": {
                    "for": {
                        "in": "Category"
                    }
                },
                "columns": {
                    "for": {
                        "in": "Column"
                    }
                },
                "values": {
                    "select": [
                        {
                            "for": {
                                "in": "Measure"
                            }
                        }
                    ],
                    "dataReductionAlgorithm": {
                        "window": {
                            "count": 30000
                        }
                    }
                }
            }
        }
    ]

 

 

 

However, I'm having trouble with the API not returning all the data.

In particular, if I add a lot of columns, a warning appears on the visual saying that there are "too many values" and that not all of them can be displayed.

 

I've read about the "dataReductionAlgorithm" property, but setting it on the "columns" prevents the visual from loading at all.

I've also read about the "fetchMoreData" api, but invoking it doesn't seem to help at all with the problem.

 

So, is there a way to get all the columns in a matrix? Or am I just s**t out of luck and I have to get data in simple table format and pivot it myself in code? 

8 REPLIES 8
jprdynamicapps
Helper IV
Helper IV

Well, I thought I tried this a year ago, but I was able to resolve the problem by adding the same data reduction algorithm setting to columns. No clue why I have to set that in order to get more than 10 columns, but it worked. I believe the default for rows is 1000. Maybe the default for columns is 10?

Hope that helps someone.

jprdynamicapps
Helper IV
Helper IV

I'm working on the same issue with my custom matrix visual. I get 10 columns back even though there are more values in the column list. In previous PBI versions, I didn't get any warning, but in the current version, I get the "Too many [column] values" message.

FYI, the "Simple Matrix" visual at https://github.com/microsoft/Powerbi-Visuals-SampleMatrix does not exhibit this problem, so I'll be looking at the differences between mine and that re data mapping configuration and the traversal/fetch more data code that I have. Will post back if I solve it.

That is interesting, have you discovered anything further? I will keep this in mind in the future if I need to use pivoted data again.

Sorry, it ended up elsewhere in the thread instead of as a reply to this message.

 

I was able to resolve the problem by adding the same data reduction algorithm setting to columns. No clue why I have to set that in order to get more than 10 columns, but it worked. I believe the default for rows is 1000. Maybe the default for columns is 10?

 

v-lionel-msft
Community Support
Community Support

Hi @Master_T ,

 

Please refer to the link.

Understand data view mapping in Power BI visuals 

 

Best regards,
Lionel Chen

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

Sorry, but linking me the basic documentation on data view mappings doesn't really answer my question...

 

As I showed in the OP, the mapping configuration is correct, what I'm asking is how to retrieve ALL the data in the matrix when it exceeds the limit for a single data fetch, since the "fetchMoreData" API, from what I've discovered by testing, seems to only work in "table" mappings, it does nothing when called in "matrix" mappings.

@Master_T  not sure it would be useful to you, but I'd suggest to investigate default matrix behavior  and compare it to your custom visual. You can check what queries are sent to the storage engine and find patterns.

Eugene.

I don't know if the vague/evasive answers in this thread are because I didn't explain myself well (sorry in that case) or what, but I searched far and wide and I didn't find a way to overcome this limitation of the API. A limitation that is quite bizzarre to me, why arbitrarily limit the number of columns I can fetch in a professional BI product? I wonder if PoweBI Premium also has this limitation and this is a subtle way to "nudge" users into upgrading...

 

At any rate, in the end I had to use a normal table, instead of a matrix, I then had to write code to group the fields and compute the data aggregates myself, basically rebuilding the matrix in code from the linear table data... which again, is a ridiculous thing to do in a professional BI product, but I couldn't find any way around it.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.