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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Add one datafield to multiple measures

I have a capabilities files with some measures in it.

 

 

  "dataRoles": [
    {
      "displayName": "Chart 1 X-Axis",
      "name": "chart1_X",
      "kind": "Measure"
    },
    {
      "displayName": "Chart 1 Y-Axis",
      "name": "chart1_Y",
      "kind": "Measure"
    },
    {
      "displayName": "Chart 2 X-Axis",
      "name": "chart2_X",
      "kind": "Measure"
    },
    {
      "displayName": "Chart 2 Y-Axis",
      "name": "chart2_Y",
      "kind": "Measure"
    },
...

 

 

and I want to ad one datafield to multiple measures. But power bi sees the measure only onece.

 

GuFa_0-1633104958182.png

 

I want to have at categories.values[2] params2 instead of TotalSegment. I read the Input via a loop and would like to have TotalSegment at categories.values[2].

 

Any hints help appreciated.

 

br

1 ACCEPTED SOLUTION
dm-p
Super User
Super User

Hi @Anonymous,

It's great that you're thinking about this scenario from an end-user perspective and making sure that you have a path for it 🙂

From a data perspective, this is a limitation with Power BI that cannot be managed in this way: a column or measure can only be referenced once in an underlying query and as such cannot be mapped to the data view twice. You can't do much about it from withn the capabilities, as you want a user to be able to add a column in here; as such you will need to manage this internally when mapping your data from the data view into your viewmodel based on checking for conditions.

How you might approach this at a high-level is something like the following:

  • When mapping your data to your view model, check to see if you have anything in the chart2_X data role for the data view. You can use methods in the DataRoleHelper to assist with this.
  • If you do have a different column present, bind the values from the discovered column in your viewmodel; if not, bind the values from chart1_X's column/role.

You may find a better way based on your implementation, but this might give you some ideas to try.

Good luck,

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)




View solution in original post

2 REPLIES 2
dm-p
Super User
Super User

Hi @Anonymous,

It's great that you're thinking about this scenario from an end-user perspective and making sure that you have a path for it 🙂

From a data perspective, this is a limitation with Power BI that cannot be managed in this way: a column or measure can only be referenced once in an underlying query and as such cannot be mapped to the data view twice. You can't do much about it from withn the capabilities, as you want a user to be able to add a column in here; as such you will need to manage this internally when mapping your data from the data view into your viewmodel based on checking for conditions.

How you might approach this at a high-level is something like the following:

  • When mapping your data to your view model, check to see if you have anything in the chart2_X data role for the data view. You can use methods in the DataRoleHelper to assist with this.
  • If you do have a different column present, bind the values from the discovered column in your viewmodel; if not, bind the values from chart1_X's column/role.

You may find a better way based on your implementation, but this might give you some ideas to try.

Good luck,

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 Daniel,

 

Thank you very much for detailed explanation, it helped a lot :). At metadata I can see all the input datafields. I was able to grab and copy them into my data array. 

 

br

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.