Power BI filtering URL query Parameters - powerbi

I am trying to filter the Power BI reports using the URL query filters.The field name I am trying to filter has space so I am passing in the parameter like
?filter=DW_Project/Project_x0020_Manager_x0020_Name eq 'Max Hex'
But the reports are being filtered
I am getting the error like
Can anyone please tell what I am missing here.

The encoding looks correct. Indeed the space is escaped with _x0020_ as per the documentation. Check the name of the table and the field and make sure they are the same. Note that these names are case sensitive. You will get this error if they do not match. Since you posted only images, I can't check, but DW__Project looks like containing not one, but two underscores, while it is only one in your URL.

Related

How to make power query case insensitive for purpose of duplicate removal?

In power bi, I open the transform data, and import a table.
The table has name column with data like following:
Product 1
product 1
When I remove the duplicates, the power query is keeping both the above treating both as unique values being case sensitive.
How can I make power query case insensitive for purpose of duplicate removal?
Since you posted no code, I am assuming you did this from the UI. So:
Go into the Advanced Editor
Locate the line that starts with Table.Distinct
Change the equation criteria to something like: Table.Distinct(previousStep, {"ColumnName",Comparer.OrdinalIgnoreCase})
Be sure to add this in the correct location.
Check MS Help for the command.
If you can't figure it out, post the relevant M-Code.

Group by similar words

Is there any way to group a table by a text field, having in count that this text field is not always exactly the same?
Example:
select city_hotel, count(city_hotel)
from hotels, temp_grid
where st_intersects(hotels.geom, temp_grid.geom)
and potential=1
and part=4
group by city_hotel
order by (city_hotel) desc
The output I get is the expected, for example, City name and count:
"Vassiliki ";1
"Vassiliki";1
"Vassilias, Skiathos";1
"Vassilias";5
"Vasilikí";25
"Vasiliki";23
"Vasilias";1
But I'd want to group more this field, and get only one "Vasiliki" (or an array with all, this is not a problem) and a count of all the cells containing something similar between them.
I do not know if could this be possible. Maybe some function to text analysis or something similar?
SELECT COUNT(*), `etc` FROM table GROUP BY textfield LIKE '%sili%';
// The '%' is a SQL wildcard, which matches as many of any character as required.
You could do something like the above, choosing a word for the 'like' that best fits the spellings that your users have used.
Something that can help with that would be to do a
SELECT COUNT(*), textfield FROM table GROUP BY textfield ORDER BY textfield;
And selecting the most 'average' spelling for your words.
Otherwise you're starting to get into a bit of language processing, and for that you will want to write some code outside of SQL.
This would be something like https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
To find word's that are the same within an arbitrary margin of error.
There is a MySQL implementation here that you should be able to transpose as needed
https://stackoverflow.com/a/6392380/1287480
(credit https://stackoverflow.com/a/3515291/1287480)
.
(Personal thoughts on the topic)
You Really Really want to think about limiting the input from users that can give you this issue in the first place. It's far far better to give the users a list of places to select from, than it is to push potentially 'dirty' information into your database. That eventually always winds up with you trying to clean the information at a later time. A problem that has kept many people employed for many years.

Passing parameters in powerBI report URL?

I have to pass certain string in URL to set filter value in my PowerBI report.
I checked many articles and following caught my eye.
Link to Stack-overflow Question
Here I see that he is passing postal code equal to one of the values in filter.
I want to do something similar except, i want to use contains instead of equal.
I want filter to select all values where my provided string is present.
Ex: A project can have multiple tags, and I get them as 1 string in my data
Project1 : "#Tag A#Tag B#Tag C#"
Project2 : "#Tag A#Tag B#Tag D#"
Project3 : "#Tag B#Tag D#"
If i pass "Tag A" as part of my string then my report should show only data for Project1 and Project2 by default.
NOTE: I am new here, Please let me know if I should add/remove something from here. Thank you.

AWS CloudSearch Filter on non-indexed field

I'm trying to do a structured query with a lot of dynamic fields (potentially) in the search pattern. So far everything is good, except I want to be able to limit from the result by field that is not indexed. Is this possible?
The test search console is showing this error: "Syntax Error in query: field (fieldname) is not searchable"
All index fields that you intend to use for filtering should be marked as searchable:
I figured this out by checking out the Cloudsearch console network payload.
If you are filtering by a facet field that is not marked searchable, you have to add a second query parameter: fq=<facetFieldName>&facet.<facetFieldName>={}. This seems to filter the results as expected.

How to query mongodb with a regex in the projection?

Does anyone know if there is a way to query MongoDB and have only certain fields returned by using a regex as part of the projection?
For example: Given a collection having arbitrary field names, how might I query the collection and only return field names matching the regex '^foo'.
Possibly something like this?
db.mycollection.find({},{$regex:"^foo"})
Thanks.
Brent.
I think you need to break down the process into two pieces, the first one is retrieving the fields names from MongoDB.
Then the second piece is that you can run the regex on the result, and from there you can query the DB with the right fields.