1

Within my model I need to calculate a measure based on two related tables. The schema would be something like this:

enter image description here

enter image description here

On the table A I need to calculate a new metric called Bonus (Revenue*%bonus).

enter image description here

I'm kind of new with this tool, and I have seen a possible solution but so sure to understand it properly. What should I do, create the metric on the dashboard or in PowerBi?

I would appreciate any help.

Regards,

Alexis Olson
  • 38,724
  • 7
  • 42
  • 64
d2907
  • 798
  • 3
  • 15
  • 45

1 Answers1

4

If you have a relationship between Table A and Table B on the Contract_type column, then you can create the Bonus calculated column simply as

Bonus = TableA[Revenue] * RELATED( TableB[%bonus] )

If you need this as a measure, then put it inside a SUMX:

Bonus = SUMX ( TableA, TableA[Revenue] * RELATED( TableB[%bonus] ) )
Alexis Olson
  • 38,724
  • 7
  • 42
  • 64
  • Hi @Alexis. I have tried. But for some reason when creating the metric in table A on the dashboard PowerBI does not show me table B. Even writing the formula as you did, I'm always getting an error, and the relation does not have any problem. This is the version of power BI desktop I'm using Version: 2.65.5313.1562 – d2907 Jun 18 '19 at 17:55
  • You can't write what I did as a measure. It only works as a calculated column the way I wrote it. – Alexis Olson Jun 18 '19 at 17:58
  • Thanks a lot for your help. It was very useful. – d2907 Jun 18 '19 at 18:06