Forum Discussion
SUMIF Equivalent in DAX
Hi everyone!
I have a simple situation here, but can't figure out how to solve it. Imagine the following data model:
What I need is a measure (or maybe a column?) that shows the sum of Hours when the Project Company is different from the User company. I tried this:
Intercompany Hours = CALCULATE (Sum(Hour[Hours]);Project[Company]<>User[Company])
It does not work... I would appreciate any help!
Now it worked! :smileyhappy:
Intercompany Hours = SUMX(filter('Hour';related(Project[Project_company])<>related(User[User_company]));sum('Hour'[Hours]))
6 Replies
- vanessafvgCommunity Champion
i dont think your data is modelled correctly. Firstly how are the joined together? you need some kind of unique id that flows through to all tables ie. both project and user s should have a project id? or is that link there?
- navarrobrFrequent Visitor
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?
- vanessafvgCommunity Champion
ah ok makes sense, so what error are you getting?