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 am trying to add a measure that computes this formula:
(Col3 when Col2=X )divided by (Col3 when Col2 = Y) for the each unique item in Col1.
Example: Col A has 3 uniques --> A, B, C
For Col1 = A, New Measure = 4/8 = 0.5
For Col1 = B, New Measure = 6/3 = 2
For Col1 = C, New Measure = 3/5 = 0.6
Thank you for your help
Col1 | Col2 | Col3 |
A | X | 4 |
B | X | 6 |
C | X | 3 |
A | Y | 8 |
B | Y | 3 |
C | Y | 5 |
Solved! Go to Solution.
Hi, @learner4eva
Try this:
Measure =
var _a=CALCULATE(SUM('Table'[Col3]),FILTER(ALLEXCEPT('Table','Table'[Col1]),'Table'[Col2]="X"))
var _b=CALCULATE(SUM('Table'[Col3]),FILTER(ALLEXCEPT('Table','Table'[Col1]),'Table'[Col2]="Y"))
return DIVIDE(_a,_b)
result:
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @learner4eva
Try this:
Measure =
var _a=CALCULATE(SUM('Table'[Col3]),FILTER(ALLEXCEPT('Table','Table'[Col1]),'Table'[Col2]="X"))
var _b=CALCULATE(SUM('Table'[Col3]),FILTER(ALLEXCEPT('Table','Table'[Col1]),'Table'[Col2]="Y"))
return DIVIDE(_a,_b)
result:
Please refer to the attachment below for details
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Result measure : =
VAR _x =
CALCULATE ( SUM ( Data[Col3] ), Col2[Col2] = "X" )
VAR _y =
CALCULATE ( SUM ( Data[Col3] ), Col2[Col2] = "Y" )
RETURN
IF ( HASONEVALUE ( Col1[Col1] ), DIVIDE ( _x, _y ) )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Pls try this
Measure = sumx(FILTER('Table','Table'[Col2]="X"),'Table'[Col3]/sumx(FILTER('Table','Table'[Col2]="Y"),'Table'[Col3]))
Proud to be a Super User!
@learner4eva , Try a new measure like
divide(Sum(Table[Col3]), calculate(Sum(Table[Col3]), filter(allselected(Table), Table[Col1] = max(Table[Col1]) && Table[Col2] ="X")))
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 | |
94 | |
81 | |
66 | |
58 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |