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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
smpa01
Super User
Super User

How to pass on a parameter to a SSAS query

Does anyone know how to pass on a parameter to a SSAS query?

My current query is following

 

AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/XYZ", "Budget", [Query="EVALUATE
VAR _1 = 2021
VAR _01 = 4
VAR _2 =
    FILTER (
        dx,
        dx[DataYear] = _1
            && dx[DataCAT] = "Forecast"
    )
............
........
", Implementation="2.0"])

 

I want to pass on a parameterized value to VAR _01 like following

 

let 
    var1=4,
    Source = AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/XYZ", "Budget", [Query="EVALUATE
VAR _1 = 2021
VAR _01 = var1
VAR _2 =
    FILTER (
        dx,
        dx[DataYear] = _1
            && dx[DataCAT] = "Forecast"
    )
............
........
", Implementation="2.0"])
in 
  Source

 

Is it possible?

so far I have tried

 

let 
    var1=4,
    Source = AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/XYZ", "Budget", [Query="EVALUATE
VAR _1 = 2021
VAR _01 = """&var1&"""
VAR _2 =
    FILTER (
        dx,
        dx[DataYear] = _1
            && dx[DataCAT] = "Forecast"
    )
............
........
", Implementation="2.0"])
in 
  Source

 

but it did not work.

Thank you in advance.

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
1 ACCEPTED SOLUTION
smpa01
Super User
Super User

Found it

var1=4,
var2=Text.From(var1)
VAR _01 = CONVERT("""&var2&""",INTEGER)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

3 REPLIES 3
smpa01
Super User
Super User

Found it

var1=4,
var2=Text.From(var1)
VAR _01 = CONVERT("""&var2&""",INTEGER)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

great, just what I needed!

Thank you for share the finding😉.

 

Paul Zheng _ Community Support Team

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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