Forum Discussion
powerbifuddaa
Helper II
2 years agoFunction 'CONTAINSROW' does not support comparing values of type Text with values of type True/False
Hi, hope someone can help me out with this DAX problem.
When I make this calculated column, it works fine:
@segmentmovement = IF(OR(RELATED('Employment type'[EmploymentType_BK])="t",RELATED('Employment type'[EmploymentType_BK])="v"),
IF("E02" in SELECTCOLUMNS(FILTER('Contract History', 'Contract History'[Person_BK]=EARLIER('Contract History'[Person_BK])),"1",RELATED('Employment type'[EmploymentType_BK])),1,0),0)
However, when I try to add ("E03") in this calculated column, I get an error (Function 'CONTAINSROW' does not support comparing values of type Text with values of type True/False).
@segmentmovementV2 = IF(OR(RELATED('Employment type'[EmploymentType_BK])="t",RELATED('Employment type'[EmploymentType_BK])="v"),
IF(OR("E02","E03") in SELECTCOLUMNS(FILTER('Contract History', 'Contract History'[Person_BK]=EARLIER('Contract History'[Person_BK])),"1",RELATED('Employment type'[EmploymentType_BK])),1,0),0)
What do I do wrong and what can be the sollution?
Thank you very much. Regards, Elmer
Hi,
OR is evaluating two expressions and must return TRUE or FALSE for each,
You can try something like that:VAR _ARRAY = SELECTCOLUMNS(FILTER('Contract History', 'Contract History'[Person_BK]=EARLIER('Contract History'[Person_BK])),"1",RELATED('Employment type'[EmploymentType_BK])) VAR CONDITION_1 = "EO2" IN _ARRAY VAR CONDITION_2 = "EO3" IN _ARRAY RETURN IF( OR(CONDITION_1,CONDITION2), 1,0)Thanx!
After mixing and trying this worked:@segmentmovement =VAR _ARRAY1 = SELECTCOLUMNS(FILTER('Contract History', 'Contract History'[Person_BK]=EARLIER('Contract History'[Person_BK])),"1",RELATED('Employment type'[EmploymentType_BK]))VAR _Condition_1 = "E02" IN _ARRAY1VAR _Condition_2 = "E03" IN _ARRAY1VAR _Condition_3 = "E04" IN _ARRAY1RETURNIF(OR(RELATED('Employment type'[EmploymentType_BK])="t",RELATED('Employment type'[EmploymentType_BK])="v"),IF(_Condition_1 || _Condition_2 || _Condition_3,1,0))
2 Replies
- AibloyRegular Visitor
Hi,
OR is evaluating two expressions and must return TRUE or FALSE for each,
You can try something like that:VAR _ARRAY = SELECTCOLUMNS(FILTER('Contract History', 'Contract History'[Person_BK]=EARLIER('Contract History'[Person_BK])),"1",RELATED('Employment type'[EmploymentType_BK])) VAR CONDITION_1 = "EO2" IN _ARRAY VAR CONDITION_2 = "EO3" IN _ARRAY RETURN IF( OR(CONDITION_1,CONDITION2), 1,0)- powerbifuddaa
Helper II
Thanx!
After mixing and trying this worked:@segmentmovement =VAR _ARRAY1 = SELECTCOLUMNS(FILTER('Contract History', 'Contract History'[Person_BK]=EARLIER('Contract History'[Person_BK])),"1",RELATED('Employment type'[EmploymentType_BK]))VAR _Condition_1 = "E02" IN _ARRAY1VAR _Condition_2 = "E03" IN _ARRAY1VAR _Condition_3 = "E04" IN _ARRAY1RETURNIF(OR(RELATED('Employment type'[EmploymentType_BK])="t",RELATED('Employment type'[EmploymentType_BK])="v"),IF(_Condition_1 || _Condition_2 || _Condition_3,1,0))