Forum Discussion
FZOU
5 years agoHelper IV
Substrac two rows from same column
Hello, I need some help guys,i have this main table : I need to substract (Bike-A)- (Bike-B) if the result is negative so we display Category which is Bike,Bus,Car, i'll write you an exp : ...
- 5 years ago
Hi, FZOU
It’s my pleasure to answer for you.
According to your description, I think you can create a measure to calculate the correct result.
Like this:
Measure = VAR a = MAXX ( FILTER ( ALL ( Table2 ), Table2[Type] <> SELECTEDVALUE ( Table2[Type] ) && Table2[Category] = SELECTEDVALUE ( Table2[Category] ) ), [Value] ) RETURN IF ( SELECTEDVALUE ( Table2[Type] ) = "A" && SELECTEDVALUE ( Table2[Value] ) - a < 0 || SELECTEDVALUE ( Table2[Type] ) = "B" && SELECTEDVALUE ( Table2[Value] ) - a > 0, SELECTEDVALUE ( Table2[Category] ) )If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-janeyg-msft
5 years agoCommunity Support
Hi, FZOU
It’s my pleasure to answer for you.
According to your description, I think you can create a measure to calculate the correct result.
Like this:
Measure =
VAR a =
MAXX (
FILTER (
ALL ( Table2 ),
Table2[Type] <> SELECTEDVALUE ( Table2[Type] )
&& Table2[Category] = SELECTEDVALUE ( Table2[Category] )
),
[Value]
)
RETURN
IF (
SELECTEDVALUE ( Table2[Type] ) = "A"
&& SELECTEDVALUE ( Table2[Value] ) - a < 0
|| SELECTEDVALUE ( Table2[Type] ) = "B"
&& SELECTEDVALUE ( Table2[Value] ) - a > 0,
SELECTEDVALUE ( Table2[Category] )
)If it doesn’t solve your problem, please feel free to ask me.
Best Regards
Janey Guo
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.