Forum Discussion
Cross-Sell Analysis
- 6 years ago
Hi gdecome
It's not able to combine the 2 logics into one calculation, if you'd like to get the counts of which only have related prod items, using below measure:
Measure = var a = SELECTEDVALUE('Table'[Prod]) var b = SELECTEDVALUE('Table 2'[Prod]) var t =DISTINCT( UNION(ROW("Prod",a),ROW("Prod",b)) ) Return COUNTROWS(FILTER(all('Table'[Order]),CALCULATE(var t2=CALCULATETABLE(VALUES('Table'[Prod]),ALLSELECTED('Table'[Prod])) return COUNTROWS ( t2 ) = COUNTROWS ( t ) && ISEMPTY ( EXCEPT ( t, t2 ) ))))If you'd like to get the counts of which Inclusive of prod items, use this one:
Measure 2 = var t1 = SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Prod]=SELECTEDVALUE('Table 2'[Prod])),"order",[Order]) Return CALCULATE(DISTINCTCOUNT('Table'[Order]),INTERSECT(t1,VALUES('Table'[Order])) )attached pbix for your ease.
Hi v-diye-msft, after a review I better understand the two calculations you and I would say both make sense. What I´m thinking as result is a combination of two. The first for the diagonal (when product is the same in row/column) and the second table for the rest. Is it possible?
Hi gdecome
It's not able to combine the 2 logics into one calculation, if you'd like to get the counts of which only have related prod items, using below measure:
Measure = var a = SELECTEDVALUE('Table'[Prod])
var b = SELECTEDVALUE('Table 2'[Prod])
var t =DISTINCT( UNION(ROW("Prod",a),ROW("Prod",b)) )
Return COUNTROWS(FILTER(all('Table'[Order]),CALCULATE(var t2=CALCULATETABLE(VALUES('Table'[Prod]),ALLSELECTED('Table'[Prod])) return COUNTROWS ( t2 ) = COUNTROWS ( t )
&& ISEMPTY ( EXCEPT ( t, t2 ) ))))
If you'd like to get the counts of which Inclusive of prod items, use this one:
Measure 2 = var t1 = SELECTCOLUMNS(FILTER(ALL('Table'),'Table'[Prod]=SELECTEDVALUE('Table 2'[Prod])),"order",[Order])
Return
CALCULATE(DISTINCTCOUNT('Table'[Order]),INTERSECT(t1,VALUES('Table'[Order]))
)
attached pbix for your ease.
- gdecome6 years agoHelper III
Hi v-diye-msft , thank you very much for your support.