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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Petanek333
Helper III
Helper III

Dynamic value in a query used in Power Automate

Hi,

I have a report of account receivables and in the end I want to send 4 different tables via email to different sales representatives. 

Understandably I want to send each sales representative a table of only their customers. 

I found a great video how to do this in Power Automate: https://www.youtube.com/watch?v=tbNvNk11sXM 

Jason uses "Run a query against a dataset" option and copies the query of specific visual from Performance analyzer. 

My query would like this (I deleted all parts of the code that are not important):

// DAX Query
DEFINE
  VAR __DS0FilterTable = 
    TREATAS({"Sales representative A"}, 'Reps table'[Rep])

  VAR __DS0FilterTable2 = 
    FILTER(
      KEEPFILTERS(VALUES('My measure'[Measure])),
      ''My measure'[Measure] = 10
    )
  VAR __ValueFilterDM1 = 
    FILTER(
"these are not important parameters"
    )

The only important part is the first TREATAS function, where Sales representative A is selected. Suppose I have 5 Sales representatives, I could create 5 static power automate buttons and each of them would contain a query for the specific sales representative. But is there any way how to make one dynamic flow in power automate that would change the query parameters based on a slicer value selected? I don't know if I can use a variable in a power automate query.

3 REPLIES 3
Anonymous
Not applicable

Hi @Petanek333 ,

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it.

 

Best regards,
Community Support Team_Binbin Yu

Hi @Anonymous  I did not have time to try it yet. I hope to get to it in a couple of days and will respond hopefully with accepting as solution 🙂

AlexisOlson
Super User
Super User

You can pass dynamic content into the DAX Query to use as the string for the sales representative. It might look like this if it's coming from a variable:

AlexisOlson_0-1672521385221.png

 

If you have trouble, I'd recommend the Power Automate forums rather than the Power BI forums for troubleshooting how to make the dynamic content work.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors