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
Anonymous
Not applicable

custom visual adding dataview table

Hi,

 

im using this custom visual template :  https://github.com/microsoft/powerbi-visuals-gantt/blob/master/capabilities.json

This works fine! 

In addition to the categorical filter i need to insert data without filtering, thats why i need an additional table!? 

 

The Import data has only one column and 10 rows.

Just to be clear: An array in code with 10 indeces could solve this! 

 

What i tried:

I add a new field "mydataset" to role and table to the existing capabilities.json

But i cant acces my data: -> "dataView.table "is null

 

 

{
    "dataRoles": [
        {
            "name": "Legend",
            "displayName": "Legend",
            "displayNameKey": "Role_Legend",
            "kind": "Grouping"
        },
        {
            "name": "Task",
            "displayName": "Task",
            "displayNameKey": "Role_Task",
            "kind": "Grouping"
        },
        {
            "name": "My Data Set",
            "displayName": "mydataset",
            "displayNameKey": "Role_mydata",
            "kind": "Grouping"
        },
        {
            "name": "Parent",
            "displayName": "Parent",
            "displayNameKey": "Role_Parent",
            "kind": "Grouping"
        },

.....
....
...
 "categorical": {
                "categories": {
                    "select": [
                        {
                            "for": {
                                "in": "Task"
                            }
                        },
                        {
                            "for": {
                                "in": "Parent"
                            }
                        },
                    
                        {
                            "for": {
                                "in": "StartDate"
                            }
                        },
                        {
                            "for": {
                                "in": "Resource"
                            }
                        },
                        {
                            "for": {
                                "in": "ExtraInformation"
                            }
                        },
                        {
                            "for": {
                                "in": "Milestones"
                            }
                        }
                    ]
                },
                "values": {
                    "group": {
                        "by": "Legend",
                        "select": [
                            {
                                "for": {
                                    "in": "EndDate"
                                }
                            },
                            {
                                "for": {
                                    "in": "Duration"
                                }
                            },
                            {
                                "for": {
                                    "in": "Completion"
                                }
                            }
                        ]
                    }
                }
            }
        } , {
            "table": {
                "rows": {
                    "for": {
                        "in": "mydataset"
                    }
                }
            }
        }
    ],
    "objects": {
        "general": {
            "displayName": "General",
            "displayNameKey": "Visual_General",
            "properties": {
                "groupTasks": {
                    "displayName": "Group Tasks",
                    "displayNameKey": "Visual_GroupTasks",
                    "type": {
 ......
.....

 

 

"matrix" : null,

"table" : null,

...

categorical: {...}

 

Edit:

I think is not possible to use more then one dataviewmapping like categorical and table.

Please let me know if I'm wrong.

 

Thanks

 

 

 

 

 

 

3 REPLIES 3
dm-p
Super User
Super User

Hi @Anonymous,

You can only use one dataViewMapping in a custom visual, so you need to think about which one best suits your need to get the data into the visual to begin with. Once it's in there, you can transform it into a suitably-shaped view model to fit your visual logic.

If you're able to provide an overview of what your goals are, I might be able to suggest what your dataViewMapping and dataRoles need to look like. From where you're starting off, it looks like you're trying to produce gantt-like functionality? If you have any sample data and what your expected output is, this would be a great help in figuring out the best way to assist. Custom visuals can be somewhat open-ended so anything that can clarify what success looks like will hopefully avoid as much ambiguity up-front as possible.

Cheers,

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)




Anonymous
Not applicable

Hi,

thanks for support.

 

The Date is filtered with a timeline slicer. This causes my records to be filtered by date as well.

But I need in my custom visual additional records that are not filtered by date but by another value. Like the option "Show item with no data" but this has no effect, on my datarole field

 

Example:
I need to visualise the "blue" entries -this works!

But i also need entries only filtered by Table2.Teams ("green").  How can I access the same Team (blue  green) entries without being affected by the date filter?

 

Table1

NameTaskStarttimeEndtime Team
Testuser1Task11/12/201920/12/2019Team1
TestUser1Task222/12/201930/12/2019Team1
TestUser3Task01/11/20193/11/2019Team1
TestUser2Task71/11/20193/11/2019Team2

 

 

Table2

TeamNameadditonal fields
Team1 entry1
Team2entry2
Anonymous
Not applicable

 

You right its better to rebuild the whole model.

In my case i found a way to solve this,  i changed  "group" by selection from Legend to Task.

 

Now data is no longer filtered by legend but it my case that helps and i get all the records I need.

"values": {
                    "group": {
                        "by": "Task",
                        "select": [
                            {
                                "for": {
                                    "in": "EndDate"
                                }
                            },
                            {
                                "for": {
                                    "in": "Duration"
                                }
                            },
                            {
                                "for": {
                                    "in": "Completion"
                                }
                            }
                        ]
                    }
                }
            }

 

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.