Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have one table in data model with one row per employee, their current end previous manager, and their current and previous output:
EmployeeID | Current Manager | Current Output | Previous Manager | Previous Output |
1 | A | 10 | B | 5 |
2 | A | 20 | A | 15 |
3 | B | 30 | A | 40 |
4 | B | 5 | B | 10 |
In the reports view, I show the sum of current and previous output by current and previous manager respectively:
Current Manager | Current Output |
A | 30 |
B | 35 |
And:
Previous Manager | Previous Output |
A | 55 |
B | 15 |
I would like to left join the 'current output' table with the 'previous output' table on Current Manager = Previous Manager so I can calculate the output delta. What I want is this:
Current Manager | Current Output | Previous Output | Delta Output |
A | 30 | 55 | -25 |
B | 35 | 15 | 20 |
I have tried writing a measure to give the answer, but can't figure out how to pass the values of the delta:
Solved! Go to Solution.
You can create measures like
Current Output Measure = SUM( 'Table'[Current Output])
Previous Output Measure =
CALCULATE(
SUM( 'Table'[Previous Output]),
REMOVEFILTERS( 'Table'[Current Manager]),
TREATAS( VALUES( 'Table'[Current Manager]), 'Table'[Previous Manager])
)
Delta = [Current Output Measure] - [Previous Output Measure]
This works well and is so much simpler than what I was trying to do. Thank you.
You can create measures like
Current Output Measure = SUM( 'Table'[Current Output])
Previous Output Measure =
CALCULATE(
SUM( 'Table'[Previous Output]),
REMOVEFILTERS( 'Table'[Current Manager]),
TREATAS( VALUES( 'Table'[Current Manager]), 'Table'[Previous Manager])
)
Delta = [Current Output Measure] - [Previous Output Measure]
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 |
---|---|
54 | |
26 | |
20 | |
15 | |
11 |
User | Count |
---|---|
77 | |
62 | |
44 | |
17 | |
12 |