简体   繁体   中英

How to do a IF statement in PowerBI using 2 columns from different tables?

I'm struggling with something that should be simple:

IF Column A in table 1 = Column B in table 2 then "No Change" else "Change"

I tried creating a new column under table 1 using this:

ActionItem = IF((Column A] = related(table2[ColumnB]), "No Change", "Change")

I do have [one to many] relationship between the tables

Thanks for your help in advance

Is this a measure or column? if a measure then you need to wrap the column references with a formula (eg. sum, count, values, etc).

If there already exists a relationship between the columns then you don't need the related().

If this is in a calculated column then it should work as long as the relationship is set up directly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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