Skip to main content
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Helper I
Helper I

SAP BW - How to write conditional M statement to pass a range of values as a parameter

Hi community,


I am new in general to editing power query code so please be gentle and explicit in your guidance 🙂 I am querying SAP BW, and trying to limit data extracted (vs. filtering after it loads in PQ).


In the highlighted step below, I would like to not have to specify individual values, and instead, either use:

  • a range of values (10000091220000 - 10000091229999)
  • a wildcard (1000009122*)
  • an if loop (if [!V000010] starts with 1000009122, then grab the record, else don't)


Add Items expects individual selection for this parameter (see below). Is what I want to do even possible?







New Member

Hi @klp97, did you find a solution for this problem? I am exploring the exact same issue at the moment...

Community Support
Community Support

Hi @klp97 


You can try using a MDX statement to filter when you first configure the connection. Use the SAP Business Warehouse (BW) Connector in Power BI Desktop - Power BI | Microsoft Learn


The Basic MDX Query (MDX) | Microsoft Learn


Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it. Highly appreciate your Kudos!

Hello, thank you for the suggestion. I am not familiar with writing MDX queries - do you have any specific guidance on how I might write the query for what I would like to accomplish?

Helpful resources

Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors
Top Kudoed Authors