简体   繁体   English

比较两列的值,如果有马赫,则在第三列返回

[英]Compare values from two columns and return in 3rd column if there is mach

I need to compare and mach a value from column B to a values from column A. The criteria I need to fulfil are.我需要将 B 列中的值与 A 列中的值进行比较和匹配。我需要满足的标准是。

  1. The comparison and mach should be performed for standard timestamps.应针对标准时间戳执行比较和马赫。 (Starting point of column A values need to be timestamp of value from column B that need to be looked for. And stop time a month of registers of column A value after start point. Or 50 values of column A starting from same row as the comparison valu from column A) (A列值的起点需要是需要查找的B列值的时间戳。并且在起点之后停止A列值的寄存器一个月的时间。或者从与A列相同的行开始的50个值A列的比较值)

Hope it makes sense.希望这是有道理的。 I did that on excel but I am trying to do it on Power Bi or excel query我在 excel 上做到了,但我试图在 Power Bi 或 excel 查询上做到这一点

Example:例子:

look for value B1 in the rangeA1-A51 if found return "Yes" otherwise "no" in C1 ( is it easier to check the range of A column values from the date Column?)如果找到,则在 A1-A51 范围内查找值 B1,否则返回“是”,否则在 C1 中返回“否”(从日期列检查 A 列值的范围是否更容易?)

Look for B2 in range B2-B52 if found return "Yes" otherwise "no" in C2在 B2-B52 范围内查找 B2,如果找到返回“是”,否则在 C2 中返回“否”

Look for B3 in range B3-B53 if found return "Yes" otherwise "no" in C3.........在 B3-B53 范围内查找 B3,如果找到返回“是”,否则在 C3 中返回“否”............

Date  column A  column B  Column C
1       124       136       Yes    
2       245       268        No
3       567       456        Yes
4       136       744        No
5       566       909        Yes
6       456       888        No
7       555       434        No
8       909       111        No
9       439       222        Yes
.       ...       ...        ...
.       ...       ...        ...
.       ...       ...        .. 
48      481       333        No
49      222       767        No
50      989       321        No
51      790       015        No

If you want this to be achieved through a DAX calculated column如果您希望通过 DAX 计算列来实现这一点

Column C =
IF ( ( 'Table'[column B] ) IN VALUES ( 'Table'[column A] ), "Yes", "No" )

If you want this to be achieved through a DAX measure如果您希望通过 DAX 度量来实现这一点

Measure = 
VAR _lookUP = CALCULATE (
    MAX ( 'Table'[column A] ),
    FILTER (
        ALL ( 'Table' ),
        ( 'Table'[column A] ) IN SUMMARIZE ( 'Table', 'Table'[column B] )
    )
)
RETURN IF(_lookUP=BLANK(),"No","Yes")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM