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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
adriansuteu
Advocate I
Advocate I

Calculate Total Sales Value while taking the prices/product from a different table

I have the following tables:

Sales with column ProductID, among others

Products with columns ProductID and Price among others.

 

I need to create a visual that will take the Revenue.

My question is how do I take the Price from the related table?

 

The same product can appear multiple times in the Sales table and I need to sum this Revenue.

 

 

 

 

1 ACCEPTED SOLUTION

Didn't work for me.

 

But I figured it out by creating a new column in the Orders table

RevenuePerSale = 'Sales'[Quantity] * related(Products[Item Price])

 

 

And then the desired measure: Revenue ($) = sum(Sales[RevenuePerSale])

View solution in original post

4 REPLIES 4
DenysDnepr
Advocate I
Advocate I

It's ok to create NEW column, when you don't have much data.

In case you have a lot of data, it will increase storage volume, and, perhaps, slow down calculations.

 

instead, Try the only measure:

 

Revenue = sumx( addcolumns( 'Sales'; "new column"; 'Sales'[Quantity] * related(Products[Item Price])); [new column])

@DenysDnepr 

 

Mesaure seems to work well in a table with small dataste. However it takes ages in matrix.

 

Is there another way which maybe works fatser.

 

This is the measure I'm using as per your suggetion

SUMX(ADDCOLUMNS(PriceList,"new column",Qty[Measure]*PriceList[Retailer]),[new column])Capture.JPG

 

and image shows my tables 

Vvelarde
Community Champion
Community Champion

@adriansuteu

 

hi

 

use this measure:

 

Revenue = Sum(Sales[Units])*sum('Product'[Price])

 

And in a visual insert Product (from Product Table) and Revenue.

 

 




Lima - Peru

Didn't work for me.

 

But I figured it out by creating a new column in the Orders table

RevenuePerSale = 'Sales'[Quantity] * related(Products[Item Price])

 

 

And then the desired measure: Revenue ($) = sum(Sales[RevenuePerSale])

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.