Forum Discussion
Expressions that yield variant data-type cannot be used to define calculated columns
Hi Experts,
I am getting this error "Expressions that yield variant data-type cannot be used to define calculated columns" when using SWITCH(TRUE()) condition as below .
here i am resulting only text (Yes or No) but i don't know how this error occurred.
[Total FY Forecast] is Currency data type , rest all text data type
Please help to solve this ?
Thanks
DK
6 Replies
- lbendlin
Super User
Your switch statement is malformed.
Key account Rule = SWITCH ( TRUE (), ( [Total FY Forecast] > 500000 ), "Yes" || 'Test Delivery Updates'[Delivery Model] = "Embedded", "Yes" || 'Test Delivery Updates'[PACE Account] = "Yes", "Yes" || 'Test Delivery Updates'[Engagement run with DPOT] = "Yes", "Yes" || 'Test Delivery Updates'[Account requires focus] = "Yes", "Yes" )You seem to have shifted the conditions and the values.
Please provide a more detailed explanation of what you are aiming to achieve.
- AnonymousNot applicable
lbendlin Thanks for your response 🙂
Actual requirement is below :
Key Account Logic :
-----------------
if "Delivery model"="Embedded" or Forecast > 500K ="Yes" or "PACE Account"="Yes" or "Engagement run with DPOT"="Yes" or "Account requires focus"="Yes" then it is key account.
All the accounts are having the above columns and if any one of the conditions is matched then the calcluated column will give YES else NO . I need to use this calculated column to filter pane to choose YES or NO.
Already having a measure :
Total FY Forecast = SUMX(VALUES('Test Delivery Updates'[FY Forecast]),CALCULATE(DISTINCT('Test Delivery Updates'[FY Forecast]))) --> which is used in the SWITCH DAX .- lbendlin
Super User
Key account Rule = IF ( [Total FY Forecast] > 500000 || [Delivery Model] = "Embedded" || [PACE Account] = "Yes" || [Engagement run with DPOT] = "Yes" || [Account requires focus] = "Yes" , "Yes","No" )Note: You cannot (should not) use a measure to fill a calculated column. Calculated columns only have row context, not filter context.