Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi Superhero,
I'm having Name and country column (which is coming from two differnt tables), I want to create dynamic measure which same name having two differnt country then it should be 1 else 0. Please see my below data.
I need dynamic calculated measure.
Solved! Go to Solution.
Hi @Murali777 ,
According to your description, I modify my sample, here's my solution.
Create a measure.
Measure_Flag =
VAR _T =
CALCULATE (
DISTINCTCOUNT ( Table2[Country] ),
FILTER ( ALL ( 'Table' ), 'Table'[Name] = MAX ( 'Table'[Name] ) )
)
RETURN
IF (
_T > 1,
1,
IF (
CALCULATE (
MAX ( 'Table2'[Country] ),
FILTER ( ALL ( 'Table' ), 'Table'[Name] = MAX ( 'Table'[Name] ) )
)
= MAX ( 'Table2'[Country] ),
0,
BLANK ()
)
)
Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Murali777 ,
According to your description, here's my solution.
Create a measure.
Measure_Flag =
VAR _T =
COUNTROWS (
FILTER (
ALL ( 'Table' ),
'Table'[Name] = MAX ( 'Table'[Name] )
&& 'Table'[Country] <> MAX ( 'Table'[Country] )
)
)
RETURN
IF ( _T > 0, 1, 0 )
Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HI Kalyj,
Thanks for your code. i'm getting the country coloumn from the different table. How can i use the second table in the above script ?
I have tried, but getting some error.
Hi @Murali777 ,
According to your description, I modify my sample, here's my solution.
Create a measure.
Measure_Flag =
VAR _T =
CALCULATE (
DISTINCTCOUNT ( Table2[Country] ),
FILTER ( ALL ( 'Table' ), 'Table'[Name] = MAX ( 'Table'[Name] ) )
)
RETURN
IF (
_T > 1,
1,
IF (
CALCULATE (
MAX ( 'Table2'[Country] ),
FILTER ( ALL ( 'Table' ), 'Table'[Name] = MAX ( 'Table'[Name] ) )
)
= MAX ( 'Table2'[Country] ),
0,
BLANK ()
)
)
Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyj
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you.. Its working fine.
Hi @Murali777 ,
Please try the below calculated column,
Measure_Flag =
var _1 = calculate(countrows(<table_name>),filter(<table_name>,Name=earlier(Name))
return if(_1>1,1,0)
* Please Mark my post as a solution if it solves your Problem
Hi Aburar,
Thanks for your reply.. i want calculatd measure.. not calculated column.
Kindly help me for measure..
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |