Forum Discussion
Comparison between X & Y using many criteria
- 5 years ago
Hi, cocolinho
It’s my pleasure to answer for you.
I’m a little confused about what you want to calculate, but I tried to understand and calculated the percentage of the total when X=YES and Y=NO under the same type.
Like this:
Measure = VAR tab = SUMMARIZE ( ALL ( TableXY ), TableXY[type], "y=no", VAR x = COUNTROWS ( FILTER ( ALL ( TableXY ), TableXY[type] = EARLIER ( TableXY[type] ) && TableXY[availbility] = "YES" && TableXY[competitor] = "X" ) ) VAR y = COUNTROWS ( FILTER ( ALL ( TableXY ), TableXY[type] = EARLIER ( TableXY[type] ) && TableXY[availbility] = "NO" && TableXY[competitor] = "Y" ) ) RETURN IF ( x > 0 && y > 0, 1, 0 ), "x=yes", VAR x = COUNTROWS ( FILTER ( ALL ( TableXY ), TableXY[type] = EARLIER ( TableXY[type] ) && TableXY[availbility] = "YES" && TableXY[competitor] = "X" ) ) RETURN IF ( x > 0, 1, 0 ) ) VAR yno = COUNTROWS ( FILTER ( tab, [y=no] = 1 ) ) VAR xyes = COUNTROWS ( FILTER ( tab, [x=yes] = 1 ) ) RETURN DIVIDE ( yno, xyes )If it doesn’t solve your problems, 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.
Hi, cocolinho
It’s my pleasure to answer for you.
I’m a little confused about what you want to calculate, but I tried to understand and calculated the percentage of the total when X=YES and Y=NO under the same type.
Like this:
Measure =
VAR tab =
SUMMARIZE (
ALL ( TableXY ),
TableXY[type],
"y=no",
VAR x =
COUNTROWS (
FILTER (
ALL ( TableXY ),
TableXY[type] = EARLIER ( TableXY[type] )
&& TableXY[availbility] = "YES"
&& TableXY[competitor] = "X"
)
)
VAR y =
COUNTROWS (
FILTER (
ALL ( TableXY ),
TableXY[type] = EARLIER ( TableXY[type] )
&& TableXY[availbility] = "NO"
&& TableXY[competitor] = "Y"
)
)
RETURN
IF ( x > 0 && y > 0, 1, 0 ),
"x=yes",
VAR x =
COUNTROWS (
FILTER (
ALL ( TableXY ),
TableXY[type] = EARLIER ( TableXY[type] )
&& TableXY[availbility] = "YES"
&& TableXY[competitor] = "X"
)
)
RETURN
IF ( x > 0, 1, 0 )
)
VAR yno =
COUNTROWS ( FILTER ( tab, [y=no] = 1 ) )
VAR xyes =
COUNTROWS ( FILTER ( tab, [x=yes] = 1 ) )
RETURN
DIVIDE ( yno, xyes )
If it doesn’t solve your problems, 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.
Thanks already @v-janeyg-msft & @amitchandak for your replies. I didn't have time to go through it yet but I will very soon and keep this thread up to date.
Cheers