Forum Discussion
Anonymous
6 years agoNot applicable
Calcule similarity between two item
Hi everybody ! Here is my issue : I have this set of data : SAMU FEATURE Y/N SAMU 1 A Yes SAMU 1 B Yes SAMU 1 ...
- 6 years ago
Hi Anonymous
Sorry for the late reply.
Add a measure
Measure = VAR left = CONCATENATEX ( VALUES ( 'left slicer' ), 'left slicer'[SAMU], "," ) VAR right = CONCATENATEX ( VALUES ( 'right slicer' ), 'right slicer'[SAMU], "," ) RETURN IF ( FIND ( MAX ( [SAMU] ), left, 1, 0 ) || FIND ( MAX ( [SAMU] ), right, 1, 0 ), 1, 0 )then modify a measure as below
percent = VAR P = CALCULATE ( DISTINCTCOUNT ( 'Table'[FEATURE] ), FILTER ( 'Table', [similarity1] = 1 && [Measure] = 1 ) ) / CALCULATE ( DISTINCTCOUNT ( 'Table'[FEATURE] ), FILTER ( ALLSELECTED ( 'Table' ), [Measure] = 1 ) ) RETURN IF ( ISBLANK ( P ), 0, P )Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
6 years agoNot applicable
Hey Maggie,
i hope you're good today.
So here is a better view of my dataset :
And here is the number i want, dpeending on what SAMU i chose in the left and right slicers.
thanks !
v-juanli-msft
Community Support
6 years agoHi Anonymous
Sorry for the late reply.
Add a measure
Measure =
VAR left =
CONCATENATEX (
VALUES ( 'left slicer' ),
'left slicer'[SAMU],
","
)
VAR right =
CONCATENATEX (
VALUES ( 'right slicer' ),
'right slicer'[SAMU],
","
)
RETURN
IF (
FIND (
MAX ( [SAMU] ),
left,
1,
0
)
|| FIND (
MAX ( [SAMU] ),
right,
1,
0
),
1,
0
)
then modify a measure as below
percent =
VAR P =
CALCULATE (
DISTINCTCOUNT ( 'Table'[FEATURE] ),
FILTER (
'Table',
[similarity1] = 1
&& [Measure] = 1
)
)
/ CALCULATE (
DISTINCTCOUNT ( 'Table'[FEATURE] ),
FILTER (
ALLSELECTED ( 'Table' ),
[Measure] = 1
)
)
RETURN
IF (
ISBLANK ( P ),
0,
P
)
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.