cancel
Showing results for
Did you mean:
Frequent Visitor

## Calculate between same field

I have a table, ORIGINAL_TABLE. The table has ROWS and YTD fields. In the table in the field ROWS I have the following records Sales, bonus and salary. I want to create a table in power bi that in addition to these records also have some kpis, in which case the kpis would be bonus / sales and salary / sales. Below we can see how it is and how it would like it to be.

 ORIGINAL TABLE ROWS YTD SALES 1.000 BONUS -300 SALARY -400

 NEW TABLE KPI YTD SALES 1.000 BONUS -300 SALARY -400 BONUS / SALES -30% SALARY / SALES -40%

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support Team

## Re: Calculate between same field

Hi @Souza ,

We can create calculated table using following DAX to meet your requirement.

```KPITable =
UNION (
'Table2',
ROW (
"ROWS", "BONUS/SALES",
"YTD", DIVIDE (
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "BONUS" ),
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "SALES" )
)
),
ROW (
"ROWS", "SALARY/SALES",
"YTD", DIVIDE (
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "SALARY" ),
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "SALES" )
)
)
)```

If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

BTW, pbix as attached.

Best regards,

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
2 REPLIES 2
Super User IV

## Re: Calculate between same field

Hi @Souza ,

Not sure what your question is, would you please be more specific?

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel

Proud to be a Super User!

Highlighted
Community Support Team

## Re: Calculate between same field

Hi @Souza ,

We can create calculated table using following DAX to meet your requirement.

```KPITable =
UNION (
'Table2',
ROW (
"ROWS", "BONUS/SALES",
"YTD", DIVIDE (
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "BONUS" ),
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "SALES" )
)
),
ROW (
"ROWS", "SALARY/SALES",
"YTD", DIVIDE (
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "SALARY" ),
LOOKUPVALUE ( 'Table2'[YTD], 'Table2'[Rows], "SALES" )
)
)
)```

If it doesn't meet your requirement, kindly share your sample data and excepted result to me if you don't have any Confidential Information. Please upload your files to One Drive and share the link here.

BTW, pbix as attached.

Best regards,

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

#### Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

#### Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

#### January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors