- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use of OData IN operator instead of ORs
Currently, when multiple values are selected for a column (as shown here for a table of financial transactions partitioned on the column "Division"):
the generated OData contains a list of OR-ed elements, like:
$filter=Division eq 868041 or Division eq 868045 or Division eq 868046 or Division eq 868047
Is there any way to convince Power BI to use the new IN operator?
The IN operator is for database servers such as Invantive SQL in general easier to optimize than OR.
Some background is on https://forums.invantive.com/t/optimize-odata-filters-to-improve-performance/1379
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try this syntax?
$filter=Name in ('Milk', 'Cheese', 'Donut')
Pat
Did I answer your question? Mark my post as a solution! Kudos are also appreciated!
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@mahoneypa HoosierBI on YouTube
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How do your users select values? From your pic, it seems like they are editing the query directly to get different results. Why not load all the data and create a slicer in your report?
If you do need the users to modify the query, you could have them provide a comma delimited list as a string parameter that you parse into a list with Text.Split for use in the database call. Or you could have another query for the selection, and then make a list from that to use in the main query that make the database call.
Pat
Did I answer your question? Mark my post as a solution! Kudos are also appreciated!
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@mahoneypa HoosierBI on YouTube
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The awkward thing is that we are an ISV of an OData proxy for 70+ cloud platforms (Invantive Cloud). The software is used for 20.000 companies, but we typically do not directly assist users that build reports and these are typically finance professionals with little time to learn DAX. Therefore I was looking whether we can provide a really simple and actionable tip or guidance how Power BI out-of-the-box can be convinced to use the IN-operator.
It is good to know that this is currently not possible. I will ask our SQL engine team to work on an optimization to rewrite the OR-ed terms into an IN. That should do the trick too. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you try this syntax?
$filter=Name in ('Milk', 'Cheese', 'Donut')
Pat
Did I answer your question? Mark my post as a solution! Kudos are also appreciated!
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@mahoneypa HoosierBI on YouTube
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Pat, thanks for the tip. Yes, the OData syntax is supported and works. However, I seem unable to convince Power BI Desktop to generate an IN instead of an OR when an end user just picks some values from the user interface. Educating them is quite costly.
Regards,
Guido
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Microsoft Fabric Community Conference 2025
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
Subject | Author | Posted | |
---|---|---|---|
11-19-2024 06:50 PM | |||
10-11-2024 01:20 AM | |||
11-08-2024 12:09 PM | |||
12-16-2024 01:22 PM | |||
09-30-2024 06:20 AM |