Forum Discussion
Sum up total cost
hi team,
basically, i have two tables link to each other one has all the employee's name + their certificates
the other has the details of the certificate which has the cost as well
i want to get the total cost for specific employees but i could now
https://www.up-00.com/i/00165/llfpviwd73br.png
Hi,
Here is my test tables:
Then create these columns:
Course Time = DATEDIFF(Cost[Course Start Time],Cost[Course End Time],SECOND)/3600Cost = Cost[Course Time]*Cost[Course Cost]Please try this measure:
Total Cost = CALCULATE ( AVERAGEX ( Cost, Cost[Course Cost] * Cost[Course Time] ), FILTER ( ALLSELECTED ( Cost ), Cost[Certificates] IN FILTERS ( Cost[Certificates] ) ) )The result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi
4 Replies
- kentyler
Solution Sage
I created some sample tables
and then this measurecertificate total =VAR current_employee = SELECTEDVALUE(employee[employee])VAR total_cost =calculate( Sum(certificate[cost]),certificate[employee]=current_employee,all(certificate[cost]))RETURN total_costWhich i placed on a report- AnonymousNot applicable
thank you kent so much for replaying
Unfortunately it's showing same thing does not sum up the cost. maybe i have to chnage the relationship from many to many to 1-many
- AnonymousNot applicable
just to let you know the column Cost in my certificates table is a custom column which is Course time * Cours cost
- v-gizhi-msft
Community Support
Hi,
Here is my test tables:
Then create these columns:
Course Time = DATEDIFF(Cost[Course Start Time],Cost[Course End Time],SECOND)/3600Cost = Cost[Course Time]*Cost[Course Cost]Please try this measure:
Total Cost = CALCULATE ( AVERAGEX ( Cost, Cost[Course Cost] * Cost[Course Time] ), FILTER ( ALLSELECTED ( Cost ), Cost[Certificates] IN FILTERS ( Cost[Certificates] ) ) )The result shows:
Here is my test pbix file:
Hope this helps.
Best Regards,
Giotto Zhi