Forum Discussion
If Statement Working With Two Seperate Database Tables
Maverick_BI Are you creating a new measure or new column?
rajulshahI was originally attempting to do this as a new column, however if I need to do it as a measure then I have no concerns in doing it this way.
- rajulshah3 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_BI3 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.
- rajulshah3 years agoResident Rockstar
Maverick_BI
I would need to look at the data to see why is it giving error because we have already used aggregation in the measure.