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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Two tables - Lookup

Hi - I have two tables. Sales and Return tables that show sales and return amt for different products. I want to show (or chart) in a table, the total sales and return cost for each item. When I do that, the sales amt is shown correctly but the return amt is shown as one single figure. I don't have any relationship defined between these two tables. 

 

How do I do this correctly? 

 

 return.PNGsales.PNGtotal.PNG

1 ACCEPTED SOLUTION
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Create a summary table based on Product Return table.

Summary Product Return =
SUMMARIZE (
    'Product Return',
    'Product Return'[Product],
    "Return Total", SUM ( 'Product Return'[Return] )
)

In Product Sales table, add a new calculated column using LookUpValue.

return =
LOOKUPVALUE (
    'Summary Product Return'[Return Total],
    'Summary Product Return'[Product], 'Product Sales'[Product]
)

Then, add columns [Product], [Sales] and [return] from 'Product Sales'  into table visual. Please note that when you add [return] into table visual, you should choose  'Don't summarize ' option.

1.PNG

 

If you need to show total values for this column, that is to say, you want it to be summed. Please use this formula instead:

return2 =
LOOKUPVALUE (
    'Summary Product Return'[Return Total],
    'Summary Product Return'[Product], 'Product Sales'[Product]
)
    / CALCULATE (
        COUNT ( 'Product Sales'[Product] ),
        ALLEXCEPT ( 'Product Sales', 'Product Sales'[Product] )
    )

You can see the difference between above two formulas.

2.PNG

 

Best regards,
Yuliana Gu

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

View solution in original post

3 REPLIES 3
v-yulgu-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous,

 

Create a summary table based on Product Return table.

Summary Product Return =
SUMMARIZE (
    'Product Return',
    'Product Return'[Product],
    "Return Total", SUM ( 'Product Return'[Return] )
)

In Product Sales table, add a new calculated column using LookUpValue.

return =
LOOKUPVALUE (
    'Summary Product Return'[Return Total],
    'Summary Product Return'[Product], 'Product Sales'[Product]
)

Then, add columns [Product], [Sales] and [return] from 'Product Sales'  into table visual. Please note that when you add [return] into table visual, you should choose  'Don't summarize ' option.

1.PNG

 

If you need to show total values for this column, that is to say, you want it to be summed. Please use this formula instead:

return2 =
LOOKUPVALUE (
    'Summary Product Return'[Return Total],
    'Summary Product Return'[Product], 'Product Sales'[Product]
)
    / CALCULATE (
        COUNT ( 'Product Sales'[Product] ),
        ALLEXCEPT ( 'Product Sales', 'Product Sales'[Product] )
    )

You can see the difference between above two formulas.

2.PNG

 

Best regards,
Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks Yuliana !!

petrcz
Regular Visitor

Hi, check this

https://msdn.microsoft.com/en-us/library/gg492170.aspx and this https://msdn.microsoft.com/en-us/library/ee634551.aspx

Use Earlier function to lookup a value for any single row...

The output in your case should be

 

1. Add a new column in "Sales" table, you can give it a name "Return"

2. Insert this formula in "Sales" table", column "Return"

LOOKUPVALUE('Table in whis the return is'[Return],'Table in which the return is'[Product],earlier[Product])

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.