Forum Discussion
Maverick_BI
3 years agoNew Member
If Statement Working With Two Seperate Database Tables
Hello Everyone, I have an request that has been causing me some trouble on how to resolve. I have a need for a new column to be created which uses an If or Case statement where possible. ...
rajulshah
3 years agoResident Rockstar
Maverick_BI , If you are creating a calculated measure, then you need to use an aggregated value for columns, for instance, you can use SELECTEDVALUE.
$Column Customer Ordered = IF(
SELECTEDVALUE('SYSADM ORDER'[AH_IDENT]) = 'SYSADM CUSTOMER'[ID] &&
SELECTEDVALUE('SYSADM CUSTOMER'[ID]) <> "0" ||
NOT SELECTEDVALUE('SYSADM CUSTOMER'[LOCKED]) IN {"1","3"}
,"Order","No Order"
)
Please let me know if this didn't work.
Maverick_BI
3 years agoNew Member
Hello @rajulshah, the formula is accepted in PowerBI - thank you for that answer, however I am now getting the following message.
A single value for column ‘ID’ in table ‘SYSADM CUSTOMER’ cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.
In our database we have a connection where the tables - Customer (one) can have Orders (many) - anyway to get around this or are we out of luck? Cheers.