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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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