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
If you want to have a model where there is a(n) (inactive) relationship between Costs[SourceID] and Projects[ID] (but stick to one-way filtering, please) and you want to use this relationship insted of TREATAS (virtual relationship), then your measure would be this:
Source Project v2 =
var __shouldCalculate = true()
&& HASONEVALUE( Projects[ID] )
&& not ISEMPTY( Costs )
var __output =
IF( __shouldCalculate,
CALCULATE(
SELECTEDVALUE(
Projects[Name],
"Many Sources"
),
DISTINCT( Costs[SourceID] ),
ALL( Costs ),
USERELATIONSHIP(
Costs[SourceID],
Projects[ID]
),
CROSSFILTER(
Costs[SourceID],
Projects[ID],
Both
)
)
)
RETURN
__output