Forum Discussion
SUMIF Equivalent in DAX
- 9 years ago
Now it worked! :smileyhappy:
Intercompany Hours = SUMX(filter('Hour';related(Project[Project_company])<>related(User[User_company]));sum('Hour'[Hours]))
Hi, thanks for answering!
The Hour table is my Fact Table, it has foreign keys from my two Dimension Tables (Project and User) and one measure field (hours). Is that clearer now?
I would think you would want to change to SUMX and use RELATED
CALCULATE( SUMX (Hours, Hours[Hours]), RELATED(Project[Company]) <> RELATED(User[Company]) )
Hope this helps,
David
- navarrobr9 years agoFrequent Visitor
Hi David and Vanessa,
Here is a link to my example file: http://www.syscope.com.br/files/example.zip
Here is the data model:
Here is the data, my expression should show the 10 hours below (where the user company is different from the project company):
This is the error I got with my formula:
And David, this is the error I got from your formula:
- navarrobr9 years agoFrequent Visitor
Now it worked! :smileyhappy:
Intercompany Hours = SUMX(filter('Hour';related(Project[Project_company])<>related(User[User_company]));sum('Hour'[Hours]))