Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hello ,
I want to filter text column which includes "tag within sale" , So I have used Search fucntion for it
however my data is not structured so it includes "tag within sale " (Data with space as well)
how can I filter both (with and without space )values
Please help ,and Thank you in advance
Solved! Go to Solution.
Here is my testing:
My sample:
I created a calculated column as follows.
Column 2 =
VAR _space = IF(CONTAINSSTRING('Table'[column], " "), 1, 0)
RETURN
IF(_space <> 0, "within space", "without space")
And then put this column into the slicer.
Is this the result you expect?
Best Regards,
Community Support Team _Yuliax
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Here is my testing:
My sample:
I created a calculated column as follows.
Column 2 =
VAR _space = IF(CONTAINSSTRING('Table'[column], " "), 1, 0)
RETURN
IF(_space <> 0, "within space", "without space")
And then put this column into the slicer.
Is this the result you expect?
Best Regards,
Community Support Team _Yuliax
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-xuxinyi-msft Thank you for your reply , but I am not looing for this soultion I want both (with and without space should be considered as one value)
To filter text values in Power BI that include variations of "tag within sale" with and without spaces, you can use a combination of Power Query functions. Assuming you have a column named "TextColumn" that contains the text data, you can follow these steps:
Open Power BI and go to the "Home" tab.
Click on "Transform Data" to open the Power Query Editor.
In the Power Query Editor, find and select the column containing your text data (e.g., "TextColumn").
Click on the "Transform" tab and then select "Replace Values" from the dropdown menu.
In the "Replace Values" window:
Click "OK" to close the window.
Now, repeat steps 4-6, but this time replace "tagwithin sale" (without spaces) with the same unique string "###tagwithinsale###".
Click on the "Home" tab again and select "Close & Apply" to apply the changes and close the Power Query Editor.
In your report, use the filter option to filter the "TextColumn" based on the unique string "###tagwithinsale###".
By doing this, you've replaced both variations of "tag within sale" with a common string. Now, you can easily filter the column based on this unique string, and it will capture both versions of the text, with and without spaces.
Remember that this approach assumes that the unique string you chose ("###tagwithinsale###") does not naturally appear in your data. Adjust the string as needed based on your specific data characteristics.
@123abc thank you for your reply ,In my case data is keeps on changing it is not static (space between the text is not spesific it keep on changing )
If the spacing between the words in your text data is inconsistent and keeps changing, and you want to capture variations in spacing, you can use a more flexible approach using regular expressions. Regular expressions allow you to define patterns that match different spacing variations. Here's how you can do it:
Create a Custom Column:
Add a Custom Column:
In the Power Query Editor, click on "Add Column" in the ribbon.
Choose "Custom Column."
In the formula bar, enter the following expression:
CustomColumn = if Text.ContainsRegex([YourColumnName], "(?i)tag\s*within\s*sale") then "Yes" else "No"
Replace [YourColumnName] with the actual name of your text column.
The regular expression (?:tag\s*within\s*sale) will match variations like "tag within sale," "tag within sale," "tagwithin sale," and any other combinations where there might be spaces between the words.
Filter based on Custom Column:
This approach allows for flexibility in handling variations in spacing between the words in your text data. Adjust the column name and conditions as needed based on your actual column names and data.