Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Similar to the below, I'm trying to make an IF statement with Contains but I am trying to count the times 2 (or more) affiliates appear in a customers click path together.
IF CONTAINS WITH MULTIPLE VALUES
E.g.
Selection1= HUKD
Selection2= TCB
| OrderID | Path_Taken |
| Order1 | Step1 -> Step2 -> HUKD -> TCB |
| Order2 | Step1 -> Step2 -> HUKD -> TCB |
| Order3 | Step1 -> Step2 -> HUKD -> TCB |
| Order4 | HUKD-> Step2 -> HUKD -> Step4 |
| Order5 | Step1 -> Step2 -> Step3 -> TCB |
The count would equal 3 as they appear in the paths together 3 times.
Stringer Code:
Mutual counter Code:
Mutual =
Solved! Go to Solution.
@Anonymous
Are you looking for something like this?
FilterMeasure =
COUNTROWS (
FILTER (
Orders,
VAR String = Orders[Path_Taken]
VAR Items = SUBSTITUTE ( String, " -> ", "|" )
VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T = GENERATESERIES ( 1, Length, 1 )
RETURN
ISEMPTY (
EXCEPT (
VALUES ( Stations[Station] ) ,
SELECTCOLUMNS ( T, "@Station", PATHITEM ( Items, [Value] ) )
)
)
)
)
Hi @Anonymous
is the selection from a slicer? From which table/column?
Hi @tamerj1
yes it's from a slicer, i use the stringer code to turn the selection into a string adn then use that string for the search.
Steps_affiliate_only and the affiliate_only_2 (duplicate or the original table) are the tables used. Path_taken is the column the contains is looking through
@Anonymous
I'm havinf a difficulty picturing the situation. Would you please share a screenshot of the source table?
No problem, the below looks more readable than my original example.
So there are two tables that contain these columns and rows, they're copies of eachother, the original has more columns and the duplicate just has the necessary columns.. The taxonomy4 coloumn is the affiliate list. The path taken column is the start to finish journey taken by the user.
The tables aren't linked at all, the duplicate is only for the splicer list as it wouldn't work when they were selected from the same table. But that selection just gets converted into a string so not sure if that'll be an issue.
Then the contains goes over the path_taken columns in the original table.
@Anonymous
Are you looking for something like this?
FilterMeasure =
COUNTROWS (
FILTER (
Orders,
VAR String = Orders[Path_Taken]
VAR Items = SUBSTITUTE ( String, " -> ", "|" )
VAR Length = COALESCE ( PATHLENGTH ( Items ), 1 )
VAR T = GENERATESERIES ( 1, Length, 1 )
RETURN
ISEMPTY (
EXCEPT (
VALUES ( Stations[Station] ) ,
SELECTCOLUMNS ( T, "@Station", PATHITEM ( Items, [Value] ) )
)
)
)
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 20 | |
| 11 | |
| 10 | |
| 4 | |
| 4 |
| User | Count |
|---|---|
| 34 | |
| 31 | |
| 19 | |
| 12 | |
| 11 |