Forum Discussion
NicoH
4 years agoRegular Visitor
Need help on DAX function
Hi everyone I'm confused by the DAX function. I want to compare the budget and contract amount based on a table with the budget and contract info with the columns like BudgetID, Year, Budget Amount,...
NicoH
4 years agoRegular Visitor
Hi vojtechsima
Thanks for your tip.
Please find the sample data
| budgetID | Year | department | budgetAmount |
| 110 | 2021 | IT | 4900 |
| 110 | 2022 | IT | 4700 |
| 200 | 2021 | HR | 1000 |
| 200 | 2022 | HR | 2000 |
| budgetID | Year | contractID | contractAmount |
| 110 | 2021 | c1 | 100 |
| 110 | 2022 | c2 | 200 |
| 110 | 2021 | c3 | 300 |
| 110 | 2022 | c4 | 400 |
| 110 | 2023 | c1 | 30 |
| 200 | 2021 | HR-C1 | 100 |
| 200 | 2022 | HR-C1 | 200 |
| 200 | 2022 | HR-C2 | 500 |
THe expected result
| Year | Department | BudgetAmount | ContractAmount |
| 2021 | IT | 4900 | 400 |
| 2022 | IT | 4700 | 600 |
vojtechsima
4 years agoSuper User
ContracetAmountMeasure =
CALCULATE(
SUM(Contract[contractAmount]), USERELATIONSHIP(Budget[budgetID], Contract[budgetID]))- NicoH4 years agoRegular Visitor
Could you let me know the linked key between Budget and Contract table?
- vojtechsima4 years agoSuper User
Hi, NicoH
There is a non-active relationship between BudgetID and BudgetID ( I can then call it in the measure I sent).- NicoH4 years agoRegular Visitor
But it's a many-to-many link.