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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Setting data fields is unique

Hello every one, 
NgaMoon_0-1709870857197.png

I have a small problem with my custom visuals that when I drag data into the visualizations box it can overlap, meaning I can drag "Profit" into both column and value, I want to set it to only be able to pulled into a single field. How can that be done? Below are the capabilities of Hope everyone can help

{
"dataRoles": [
{
"name": "columns",
"displayName": "Columns",
"displayNameKey": "Visual_Columns",
"kind": "Grouping"
},
{
"name": "values",
"displayName": "Values",
"displayNameKey": "Visual_Values",
"kind": "Measure"
},
],
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

As seen in the documentation (i didn't read it all), I don't know if it exists a normal way to say "don't accept this field if it has already been added".

You can probably find a way to "hard-code" this but I don't think it's a good idea.

 

However, you can manage the Data Roles in the capabilities.json file to ensure the data you drag into your fields respect the data type (related to Power BI Data Types)

Capabilities and properties of Power BI visuals - Power BI | Microsoft Learn 

 

Also, you can watch the others custom visual codes to get an idea about how you can manage your data roles:

Github Custom Visuals

 

By the way, I think the best way to develop your custom visual is not to make sure that the users won't be able to drag 2 or more times the same data, but to be sure that your data roles are well defined to prevent misunderstanding and avoid this case when the same data is dragged too much times

 

Have good day

View solution in original post

3 REPLIES 3
dm-p
Super User
Super User

This isn't currently possible. You can constrain fields by their data type (or column/measure type) in the dataRoles, but you can't prevent a user from adding the same column or measure multiple times to the data view.

 

Daniel





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

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Anonymous
Not applicable

Hi,

 

As seen in the documentation (i didn't read it all), I don't know if it exists a normal way to say "don't accept this field if it has already been added".

You can probably find a way to "hard-code" this but I don't think it's a good idea.

 

However, you can manage the Data Roles in the capabilities.json file to ensure the data you drag into your fields respect the data type (related to Power BI Data Types)

Capabilities and properties of Power BI visuals - Power BI | Microsoft Learn 

 

Also, you can watch the others custom visual codes to get an idea about how you can manage your data roles:

Github Custom Visuals

 

By the way, I think the best way to develop your custom visual is not to make sure that the users won't be able to drag 2 or more times the same data, but to be sure that your data roles are well defined to prevent misunderstanding and avoid this case when the same data is dragged too much times

 

Have good day

Anonymous
Not applicable

@lbendlin , Sorry for pinning you on this news, but can you tell me if there is a way for each data field to only be dragged and dropped into 1 visualizations  field?

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors