Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
95 | |
76 | |
65 | |
51 |
User | Count |
---|---|
146 | |
109 | |
106 | |
88 | |
61 |