Forum Discussion
systemic_till
6 years agoRegular Visitor
USERELATIONSHIP needs selection to trigger correct calculation of measure? What am I missing?
Hey, This might be a stupid question, but I seem to have a general misunderstanding when using Measures, Filters and the DAX USERELATIONSHIP function. I seems to work just fine for my dataset, ...
Anonymous
6 years agoNot applicable
Hi systemic_till ,
You can add write measure to calculate table2 records with if statement to compare current row contents with tbale1 records:
Measure =
IF (
SELECTEDVALUE ( 'Table (2)'[number 2] ) IN VALUES ( 'Table'[number 1] ),
CALCULATE (
COUNT ( 'Table (2)'[number 2] ),
USERELATIONSHIP ( 'Table'[number 1], 'Table (2)'[number 2] )
)
)
If above not help, please explain your requirement more clarify with the expected result.
Regards,
Xiaoxin Sheng
- systemic_till6 years agoRegular Visitor
Hi v-pn ,
Thanks for you answer.
It didn't clarify my issue though.
In my setup, everything works as expected, if I make a selection.
Only when nothing is selected I am getting confusing results.
My expected result is 2, when nothing is selected.
Yet, I get a result of 3 as if the USERELATIONSHIP filter was missing entirely.
So, to clarify:
// Measure 1no relationship = CALCULATE (DISTINCTCOUNT('Table (2)'[number 2])
==> that gives 3. That's ok.
//Measure 2
distinct 2s also in 1 =CALCULATE (DISTINCTCOUNT('Table (2)'[number 2]) ,USERELATIONSHIP ('Table'[number 1],'Table (2)'[number 2]))
==> that also gives 3 when no selection is made. Why is it not 2?