Forum Discussion
Evaluating if two fields (from separate tables) equal in DAX
I am trying to count a field if two fields are equal. I think the problem is the two fields are in separate tables. However the appropriate joins are in place that create a relationship between these fields/tables.
The expression I am trying to write (but it doesn't work):
Optimization = CALCULATE(countx(ITEM,ITEM[RecommendedStrategy]),FILTER(ITEM,ITEM[RecommendedStrategy]=STRATEGY[Actual Strategy]))
- Anonymous8 years ago
Anonymous,
Create the following column in your ITEM table.Column = LOOKUPVALUE(STRATEGY[Actual Strategy],STRATEGY[Actual Strategy],'ITEM'[RecommendedStrategy])
Then create the following measure in the ITEM table.Optimization = CALCULATE(COUNTROWS('ITEM'),FILTER('ITEM','ITEM'[RecommendedStrategy]='ITEM'[Column]))
Regards,
Lydia
5 Replies
- AnonymousNot applicable
Anonymous,
Create the following column in your ITEM table.Column = LOOKUPVALUE(STRATEGY[Actual Strategy],STRATEGY[Actual Strategy],'ITEM'[RecommendedStrategy])
Then create the following measure in the ITEM table.Optimization = CALCULATE(COUNTROWS('ITEM'),FILTER('ITEM','ITEM'[RecommendedStrategy]='ITEM'[Column]))
Regards,
Lydia - PattemManohar
Community Champion
Anonymous Could you please post sample data for resolving your issue.
- AnonymousNot applicable
Where is the icon to attach an excel file?
- AnonymousNot applicable
Hi
Please try RELATED in your formula.
RELATED ( STRATEGY[Actual Strategy]) )
Thanks
Raj- AnonymousNot applicable
Can't get that to work.