March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi,
I have two tables. Table one:
Product | Sold qty |
Product 1 | 1 |
Product 2 | 2 |
Product 3 | 51 |
Table two:
Product | Price |
Product 1 | 50€ |
Product 2 | 100€ |
Product 3 | 25€ |
Product 4 | 30€ |
Product 5 | 25€ |
The goal is: Sold qty * Price for each product. Outcome would be:
Product | Total sales |
Product 1 | 50€ |
Product 2 | 200€ |
Product 3 | 1275€ |
I know i could just merge these two tables in Power Query and make a calculated column. However, i want to do this with a DAX measure. How do i do this? (what kind of a relationship and DAX measure is required?)
Thanks for your help in advance!
Solved! Go to Solution.
hello @CarlsBerg999,you can calculate revenue using DAX as below screenshot shown
Please mark the post as a solution and provide a 👍 if my comment helped resolve your issue. Thank you!
Proud to be a Super User!
@CarlsBerg999 , new column in table 1
maxx(filter(Table2, Table2[product] = Table1[product]), Table[Price]) * Table1[Qty]
or
related(Table[Price]) * Table1[Qty]
Hi, The second one (related.....) works fine as a new column. What is the idea behind the the: maxx(filter(Table2, Table2[product] = Table1[product]), Table[Price]) * Table1[Qty] Is this for a measure and if not, is it possible to do the required calculation as a measure rather than a calculcated column?
hello @CarlsBerg999,you can calculate revenue using DAX as below screenshot shown
Please mark the post as a solution and provide a 👍 if my comment helped resolve your issue. Thank you!
Proud to be a Super User!
Hi,
The second one (related.....) works fine as a new column. What is the idea behind the the:
maxx(filter(Table2, Table2[product] = Table1[product]), Table[Price]) * Table1[Qty]
Is this for a measure and if not, is it possible to do the required calculation as a measure rather than a calculcated column?
hi @CarlsBerg999 - You can acheive this by creating a cacluated column; you can setup the 2 tables as seen below.
Additionaly you can use the "RELATED" function and build a calculated column to calcuate the Sales
Please mark the post as a solution and provide a 👍 if my comment helped with solving your issue. Thanks!
Proud to be a Super User!
If you have "Many to 1" or "1 to 1" relationship between ProductPrice and ProductSold table then use "RELATED" in "MANY" side of table to get the value from single side.
Lets say if you have Price table contains single row for each product and Sales table contains quantity sold of each time of product then you should create column in sold table like
Amount = Qty * RELATED (Price [Price])
Proud to be a Super User!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
54 | |
45 |
User | Count |
---|---|
204 | |
106 | |
98 | |
65 | |
54 |