The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello - i want to create an an indicator that lets me know if 2 strings have any of the same characters. This value can return anything - TRUE/FALSE, or a count of matching characters, "Y"/"N", etc.
Examples:
"123A" v "ABC" would return TRUE
"AZ4" vs "983" would return FALSE
"150BE" vs "IZF" would return FALSE
"AMZY1" vs "M25?1" would return TRUE
Try this:
col =
VAR FirstWord =
LOWER ( Colors[Colors] )
VAR SecondWord =
LOWER ( Colors[Column] )
VAR FirstWordNumSeries =
GENERATESERIES ( 1, LEN ( FirstWord ), 1 )
VAR SecondWordNumSeries =
GENERATESERIES ( 1, LEN ( SecondWord ), 1 )
VAR FirstWordCharacters =
SELECTCOLUMNS (
ADDCOLUMNS ( FirstWordNumSeries, "FW", MID ( FirstWord, [Value], 1 ) ),
"@FW", [FW]
)
VAR SecondWordCharacters =
SELECTCOLUMNS (
ADDCOLUMNS ( SecondWordNumSeries, "SW", MID ( SecondWord, [Value], 1 ) ),
"@SW", [SW]
)
VAR Result =
IF (
COUNTROWS ( FILTER ( FirstWordCharacters, [@FW] IN SecondWordCharacters ) ) > 0,
TRUE (),
FALSE ()
)
RETURN
Result
Hi @Anonymous ,
Are these 2 string separate Columns ?
Regards,
HN
one is a column, the other is a measure
User | Count |
---|---|
25 | |
10 | |
8 | |
7 | |
6 |
User | Count |
---|---|
32 | |
12 | |
10 | |
10 | |
9 |