Forum Discussion
arunbyc
Helper III
1 year agoProbably HASONEVALUE in my code causing unwanted effect? How do I fix this?
My following code displays the description of either (a) work or (b) Materials used in a project depending on whether the record is of type "time" or "materials". The column "lookup_id" in this table...
- 1 year ago
Try using ISINSCOPE instead of HASONEVALUE.
- Anonymous1 year ago
Hi arunbyc ,
I create three tables as you mentioned.
Then I think you can change the DAX code and you can try the codes below.
Description = VAR x_id = SELECTEDVALUE ( Time_and_Material[lookup_id] ) VAR display_Value = IF ( HASONEVALUE ( Time_and_Material[lookup_id] ) && SELECTEDVALUE ( Time_and_Material[type] ) = "time", CALCULATE ( SELECTEDVALUE ( work_dim[description] ), work_dim[id] = x_id ), CALCULATE ( SELECTEDVALUE ( material_dim[description] ), material_dim[id] = x_id ) ) RETURN IF ( ISINSCOPE ( Time_and_Material[ProjectID] ), display_Value, BLANK () )Best Regards
Yilong Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
AlexisOlson
Super User
1 year agoTry using ISINSCOPE instead of HASONEVALUE.