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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
hjg_123
Regular Visitor

Multiply values in two tables

Hi,

 

I'm pretty new to PowerBI and struggling with how I multiply across two tables. I have a list of clients and their sales in one one table, and then I have a list of clients and the agent who services them in another table. However, Some clients have more than one agent servicing them so that sales get split between agents.

 

So what I would like to do is produce an output by principal agent that shows their sales. I need to match the Value column in the 'Txns' table to the agent share of each client from the 'Agents' table, multiply through and then I can sum by the Prinicpal ID. 

 

I have managed to link the Clients in each table together, so there is a working relationship but stuck on the next part - any help greatly appreciated - example tables are below.

 

I know I can add an extra column in this simple example, but in the real thing I want to be able to filter by dates etc. so need it to be an expression.

 

TXNs table:

hjg_123_0-1675803259311.png

Agents table

hjg_123_1-1675803280322.png

 

Thanks

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @hjg_123 ,

 

Please try:

Measure = SUMX(Agents,CALCULATE(SUM(TXNs[Value]),FILTER('TXNs',[Clients]=EARLIER(Agents[Clients])))*[Share])

Final output:

vjianbolimsft_0-1675822634111.png

Best Regards,

Jianbo Li

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

2 REPLIES 2
v-jianboli-msft
Community Support
Community Support

Hi @hjg_123 ,

 

Please try:

Measure = SUMX(Agents,CALCULATE(SUM(TXNs[Value]),FILTER('TXNs',[Clients]=EARLIER(Agents[Clients])))*[Share])

Final output:

vjianbolimsft_0-1675822634111.png

Best Regards,

Jianbo Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ryan_mayu
Super User
Super User

@hjg_123 

what's the expected output? could you pls also provide the screenshot and the calculation logic?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
March Fabric Community Update

Fabric Community Update - March 2024

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

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.