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, I want to calculate as follow:
Minus "Value" for each bucket with "Value" from bucket 1 group by "Division"
Division | Bucket | Value | Dif |
A | 1 | 7 | 0 (7 - 7) |
A | 2 | 8 | 1 (8 - 7) |
A | 3 | 9 | 2 (9 - 7) |
B | 1 | 10 | 0 (10 - 10) |
B | 2 | 13 | 3 (12 - 10) |
B | 3 | 15 | 5 (15 - 10) |
I try to use this DAX, but it return to sum up all "Value" from Bucket = 1 from all Division.
Division | Bucket | Value | Dif |
A | 1 | 7 | -7 (7 - 17) |
A | 2 | 8 | -9 (8 - 17) |
A | 3 | 9 | -8 (9 - 17) |
B | 1 | 10 | -7 (10 - 17) |
B | 2 | 13 | -3 (12 - 17) |
B | 3 | 15 | -2 (15 - 17) |
Solved! Go to Solution.
@AN2021
Try this code please:
Difference =
Table3[Value]
-
CALCULATE(
sum(Table3[Value]),
Table3[Bucket] = 1,
ALLEXCEPT(Table3,Table3[Division])
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
It still works with new dimensions.
See attached file.
If you could share you file so as to have a look at it that would be great
@AN2021
Add the following column:
Dif = Table3[Value] - CALCULATE( MIN(Table3[Value]), ALLEXCEPT(Table3,Table3[Division]))
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi Fowmy
Actually I want to get the "Value" from Bucket = 1, not the Min of "Value". Your solution might work with my example, but in my actual case some "Value" in Bucket = 1 is not the smallest one.
@AN2021
Try this code please:
Difference =
Table3[Value]
-
CALCULATE(
sum(Table3[Value]),
Table3[Bucket] = 1,
ALLEXCEPT(Table3,Table3[Division])
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Try the following measure:
Measure3 =
VAR __bucket1 =
CALCULATE (
SUM ( Sheet1[Value] ),
FILTER ( ALLEXCEPT ( Sheet1, Sheet1[Division] ), Sheet1[Bucket] = 1 )
)
RETURN
SUM ( Sheet1[Value] ) - __bucket1
Workspace attached on this message
Hi themistoklis
Its work, but wonder why if I have more column, its not works?
From your example I add 1 column named Dim1
It still works with new dimensions.
See attached file.
If you could share you file so as to have a look at it that would be great
Oh my bad, yeap its work, thanks
@AN2021
You can click on @themistoklis solution as Accepted, this will help others find it the correct reply.
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
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 |
---|---|
115 | |
100 | |
88 | |
68 | |
61 |
User | Count |
---|---|
150 | |
120 | |
100 | |
87 | |
68 |