The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi
Im stuck with something on a bigger data set but if you can help with this example it should fix my problem!
I have two tables in my model. One is a list of clients with a total target for sales for the year. The second table is a list of projects that are being done for a client with actual revenue against each project. There is a one to many relationship between the client table and the project table.
All I want to be able to do is add a column to the target table which shows the sum of the actuals for projects that belong to each client. I just cant seem to do it even though I can do it with a visual I need to have it in a column for some other calculations.
Tables are:
Client Budget
Client | Budget |
A | 5000 |
B | 2000 |
C | 3000 |
Actuals for Project
Client | Project Name | Actual |
A | One | 100 |
B | Two | 200 |
B | Three | 300 |
B | Four | 400 |
C | Five | 500 |
C | Six | 600 |
C | Seven | 700 |
A | Eight | 800 |
This is the result I want with the new column on the right. I cant use related as it is on the one side of a one to many and I want the sum of all the actuals for projects in the second table where the client is the same as the first column in the first table. Put simply, I want it to show the total actuals for each client.
Client | Budget | Acutals |
A | 5000 | 900 |
B | 2000 | 900 |
C | 3000 | 1800 |
3600 | ||
Many thanks and super grateful for any help as I am now to this!!
Solved! Go to Solution.
Hi @WishAskedSooner ,
Thank you for your very quick and effective replies.
Hi @Nic99999 ,
I will provide two options for you to choose from, one for creating calculated columns and one for creating measure.
1. below is my model
Table:
Table2:
2. you could create measure or column with below dax formula
Column =
VAR tmp = RELATEDTABLE ( 'Table 2' ) RETURN SUMX ( tmp, [Actual] )
Measure = SUM('Table 2'[Actual])
add a table visual with fields and measure:
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @WishAskedSooner ,
Thank you for your very quick and effective replies.
Hi @Nic99999 ,
I will provide two options for you to choose from, one for creating calculated columns and one for creating measure.
1. below is my model
Table:
Table2:
2. you could create measure or column with below dax formula
Column =
VAR tmp = RELATEDTABLE ( 'Table 2' ) RETURN SUMX ( tmp, [Actual] )
Measure = SUM('Table 2'[Actual])
add a table visual with fields and measure:
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If you want a New Column (calculated column) in your 'Client Budget' table that sums the 'Actuals' column in the 'Actuals for Project' table by 'Client' which is joined in the data model, try entering the following DAX in the formula bar after clicking New Column:
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
78 | |
77 | |
43 | |
38 |
User | Count |
---|---|
150 | |
116 | |
66 | |
64 | |
55 |