Forum Discussion
Calculate an Custom Column based on Values of another Table
- 6 years ago
Hi RaptorFox ,
Try the measure.
Measure = VAR x = CALCULATE( SUM('Time Bookings'[ExternalTotalAmount]), ALLEXCEPT('Project Data', 'Project Data'[ProjectNumber]) ) VAR y = DIVIDE( x, SELECTEDVALUE('Project Data'[Budget]) ) RETURN yBest regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- 6 years ago
Hi RaptorFox ,
In "Edit queries", we use M language which doesn't have the SUMX() function.
Power Query M function reference
But we can also use M language grouping aggregation.
Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
RaptorFox very hard to follow your excel sheet, can you past sample data in a table format and explain what is your expected result.
Please share data in excel or share pbix file using onedrive/google drive to get your answer quickly. Remove any sensitive information before sharing.
- RaptorFox6 years agoFrequent Visitor
parry2k Sure, thanks!
Sample Data for Table "Time Bookings"
ProjectNumber ProjectName Employee Date Hours ExternalRate ExternalTotalAmount 651232 Project BI Implementation Peter Miller 01.04.2020 2.5 200 500 651889 ERP Renewal Tony West 03.04.2020 5 200 1000 651232 Project BI Implementation Celine Wild 20.04.2020 3 190 570 … Sample Data for Table "Project Data"
ProjectNumber ProjectName Budget 651232 Project BI Implementation 50000 651889 ERP Renewal 30000 … I expect a new row in the "Project Data" table which shows the calculated total amount of all the bookings in the "Time Bookings" table for the related project. The screenshot shows the underlying model and the relationship (the key is "ProjectNumber").
ProjectNumber ProjectName Budget UsedAmountTotal 651232 Project BI Implementation 50000 1070 651889 ERP Renewal 30000 1000 … - parry2k6 years ago
Super User
RaptorFox I assume you have one to many relationships between these two tables, just add the following measure and it should work
Used Amount Total = SUM ( TimeBookings[ExternalTotalAmount )- RaptorFox6 years agoFrequent Visitor
parry2k Thanks! Yes, this measure works, i already had it. But now, i would like to somehow calculate and show the percentage between budget and the calculated total amount, therefore i wanted to have the amount directly in the 'Project Data' table.
When i add the measure to the visual, i cannot show the proportion or percentage from the total amount to the budget, i just cannot get it done (might be and most probably is a usage issue):