Forum Discussion
LeoST
5 years agoFrequent Visitor
Switching between two relationships between two tables
Hello, I've two tables that are conneted by two relations. One table is costs and the other is Projects. They have an active relation based on there ID columns and an inactive relation between C...
- 5 years ago
LeoST , Try like
Measure =
CALCULATE(
FIRSTNONBLANK(Projects[Name],TRUE()),
USERELATIONSHIP(Costs[Source ID], Projects[ID]))Not need crossfilter
refeR: https://youtu.be/e6Y-l_JtCq4
Anonymous
5 years agoNot applicable
// In Costs, columns ID, Cost and Source ID
// should be hidden (yes, that's right).
// In Projects only Name can be visible.
// You join Projects[ID] to Costs[ID] using
// the standard one-way relationship.
// You join Projects[ID] to Costs[Source ID] using
// the standard one-way relationship (for these
// measures, though, this relationship is not required, so
// you can remove this relationship completely).
// The latter relationship will be inactive, if created.
// Once this CORRECT setup is in place, you define
// 2 measures below.
[Cost] = SUM( Costs[Cost] )
[Source Project] =
var __shouldCalculate = true()
&& HASONEVALUE( Projects[ID] )
&& not ISEMPTY( Costs )
var __output =
IF( __shouldCalculate,
CALCULATE(
SELECTEDVALUE(
Projects[Name],
"Many Sources"
),
TREATAS(
DISTINCT( Costs[Source ID] ),
Projects[ID]
),
ALL( Costs )
)
)
RETURN
__output