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
Hi everyone,
I am having some trouble with implementing a measure.
Essentially, I want PowerBI to see if there is a certain string in each link, and if so, return a value.
For example, using the sample below:
Table: Website
Link |
/penguins/123123 |
/koala/345333 |
/koala/345333 |
/penguins/123123 |
/gorilla/500222 |
/gorilla/500222 |
/fish/988933 |
If a URL contains
Penguins = PEN
Koala = KOA
Gorilla = GOR
FISH = FIS
I want the output to return:
Link | Type of website |
/penguins/123123 | PEN |
/koala/345333 | KOA |
/koala/345333 | KOA |
/penguins/123123 | PEN |
/gorilla/500222 | GOR |
/gorilla/500222 | GOR |
/fish/988933 | FIS |
I know you can use the SWITCH function, or the IF Function with CONTAINSSTRING if I was to create a column (which I can't because we use direct query). I also know to get the ^ above output, I need to add some row context, but I can't identify an iterator function that would be appropriate.
Is there a solution here? or should I rebuild by using IMPORT and then add columns.
Thank you very much! Would appreciate any clear instructions as I'm a PowerBI newbie.
Solved! Go to Solution.
Found the solution
Agent =
VAR selectedrow =
SELECTEDVALUE('website'[link])
RETURN
SWITCH (
TRUE (),
ISERROR ( FIND ( "penguins", selectedrow ) ) <> TRUE (), "PEN",
ISERROR ( FIND ( "gorilla", selectedrow ) ) <> TRUE (), "GOR",
)
Found the solution
Agent =
VAR selectedrow =
SELECTEDVALUE('website'[link])
RETURN
SWITCH (
TRUE (),
ISERROR ( FIND ( "penguins", selectedrow ) ) <> TRUE (), "PEN",
ISERROR ( FIND ( "gorilla", selectedrow ) ) <> TRUE (), "GOR",
)
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
87 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |