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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
alaynanich
Helper I
Helper I

Dynamic M Parameters to run multiple queries?

Hi PBI Community,

 

I was looking for a way to be able to feed a table to Power Query and dynamically run the same query using paramters, sort of like this article https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters

But my need is that for the sample table below, I want each individual row to be ran in its own query. For example, lets say the query for my sales db table is :

 

select * from A.sales

where sku is in ('XXX')

and sales_date between '2024-01-01' and '2024-01-02'

 

With the table below I want to only pull sales for sku 7002861 between Jan 1 and Jan 7, sku 7022746 between Dec 25 and Dec 31, and so on. Then have these sales results concatenated into one total sales query. Is it possible to do this using the dynamic query example above? I want to avoid pulling all sales and then using a measure to filter because in reality I would have hundreds of millions of rows to pull each year and only want to pull the actual sales info I need. If anyone is familiar with Alteryx, this is accomplished using the dynamic input tool to edit the query with each input. Thanks!

alaynanich_0-1706711373726.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@alaynanich , Dynamic M Parameter is for Direct query mode.

 

You can have measure like , once you have both tables in power bi

 

Sumx(SKU, sumx(filter(Sales, Sales[SKU] = SKU[SKU] && Sales[Date] >= SKU[Start] && Sales[date]<= SKU[ENd]) , Sales[Value]))

 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@alaynanich , Dynamic M Parameter is for Direct query mode.

 

You can have measure like , once you have both tables in power bi

 

Sumx(SKU, sumx(filter(Sales, Sales[SKU] = SKU[SKU] && Sales[Date] >= SKU[Start] && Sales[date]<= SKU[ENd]) , Sales[Value]))

 

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.