March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello - I want to create a measure to get the result as true or false for the below 2 conditions.
Data
Table1
Location |
SIE*KLT*JTR/MIL |
SIE*KLT*MIL |
MIL*KLT*MIL |
KLT*MIL*KLT |
SIE*KLT*RUI*MIL |
SIE*RUI*KLT*MIL |
SIE*JUY*KLT*MIL |
SIE*JUY*KLT*MIL*SIE |
SIE*RUI*KLT*MIL*SIE |
SIE*PLI*SIE |
SIE*QWE*SIE |
SIE*AKL/SIE |
SIE*AKL |
SIE*AKL*PLO |
SIE*RUI/KLT*MIL |
SIE*JUY*KLT |
Thanks
Solved! Go to Solution.
Hi, @gauravnarchal
You can try the following function to write measure.
Measure1 = LEFT ( MAX('Table'[Location]), 3 ) = "SIE"
&& (
CONTAINSSTRING ( MAX('Table'[Location]), "RUI" )
|| CONTAINSSTRING ( MAX('Table'[Location]), "KLT" )
|| CONTAINSSTRING ( MAX('Table'[Location]), "AKL" )
)
Measure2 =
LEFT ( MAX ( 'Table'[Location] ), 3 ) = "SIE"
&& RIGHT ( MAX ( 'Table'[Location] ), 3 ) = "SIE"
&& (
CONTAINSSTRING ( MAX ( 'Table'[Location] ), "RUI" )
|| CONTAINSSTRING ( MAX ( 'Table'[Location] ), "KLT" )
|| CONTAINSSTRING ( MAX ( 'Table'[Location] ), "AKL" )
)
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @gauravnarchal
You can try the following function to write measure.
Measure1 = LEFT ( MAX('Table'[Location]), 3 ) = "SIE"
&& (
CONTAINSSTRING ( MAX('Table'[Location]), "RUI" )
|| CONTAINSSTRING ( MAX('Table'[Location]), "KLT" )
|| CONTAINSSTRING ( MAX('Table'[Location]), "AKL" )
)
Measure2 =
LEFT ( MAX ( 'Table'[Location] ), 3 ) = "SIE"
&& RIGHT ( MAX ( 'Table'[Location] ), 3 ) = "SIE"
&& (
CONTAINSSTRING ( MAX ( 'Table'[Location] ), "RUI" )
|| CONTAINSSTRING ( MAX ( 'Table'[Location] ), "KLT" )
|| CONTAINSSTRING ( MAX ( 'Table'[Location] ), "AKL" )
)
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You can do this with LEFT and CONTAINSSTRING.
LEFT ( Table1[Location], 3 ) = "SIE"
&& (
CONTAINSSTRING ( Table1[Location], "RUI" )
|| CONTAINSSTRING ( Table1[Location], "KLT" )
|| CONTAINSSTRING ( Table1[Location], "AKL" )
)
Something along the lines of a Custom Column in Power Query like
if Text.StartsWith([Location],"SIE") and (Text.Contains([Location],"RUI") or Text.Contains([Location],"KLT") or Text.Contains([Location],"AKL")) then true
else false
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
114 | |
76 | |
57 | |
52 | |
44 |
User | Count |
---|---|
168 | |
116 | |
63 | |
57 | |
50 |