We're giving away 30 tickets for FREE! Share your story, your vision, or your hustle and tell us why YOU deserve a ticket.
Apply nowWin a FREE 3 Day Ticket to FabCon Vienna. Apply now
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!
Solved! Go to Solution.
Now it worked!
Intercompany Hours = SUMX(filter('Hour';related(Project[Project_company])<>related(User[User_company]));sum('Hour'[Hours]))
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?
Proud to be a Super User!
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
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:
Now it worked!
Intercompany Hours = SUMX(filter('Hour';related(Project[Project_company])<>related(User[User_company]));sum('Hour'[Hours]))
ah ok makes sense, so what error are you getting?
Proud to be a Super User!
User | Count |
---|---|
67 | |
61 | |
47 | |
35 | |
32 |
User | Count |
---|---|
87 | |
72 | |
56 | |
49 | |
45 |