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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Asheesh
New Member

Unable to get desired rows from parameterized function

Dear All, 

I am trying to return a row/ column from a parameterized function. Having below two data models -

Employee
Employee IdEmployee NameSalary
1001SAM 90,00,000.00
1002John 70,00,000.00
1003Rodrix 50,00,000.00

 

SalaryGrades
Grade IDMin SalMax Sal
1   75,00,001.00 99,00,000.00
2   60,00,001.00 75,00,000.00
3   45,00,001.00 60,00,000.00

 

Below is the function which I created and using to add a new column -

 

//Function name GetSalGrade(InputSal as number)
= (InputSal as number) =>
let
#"SingleRowSal" = Table.SelectRows(#"SalaryGrades",each [Min Sal]>=InputSal and [Max Sal]<=InputSal),
Source = #"SingleRowSal"
in
Source

 

I am passing the values as 76,00,000 OR 65,00,000 OR 50,00,000 and each time it is returning a blank table.

My desired data model should be like below -

EmployeeSalaryGrade
Employee IdEmployee NameSalaryEmployee Garde
1001SAM 90,00,000.001
1002John 70,00,000.002
1003Rodrix 50,00,000.003

 

(Actually I will add a new column EmployeeGrade in the existing Employee Model)

Please suggest what wrong I am doing.

1 ACCEPTED SOLUTION
AlB
Community Champion
Community Champion

Hi @Asheesh 

Small change to your function:

(InputSal as number) =>
let
SingleRowSal = Table.SelectRows(#"SalaryGrades",each [Min Sal]<=InputSal and [Max Sal]>=InputSal),
Source = try SingleRowSal[Grade ID]{0} otherwise null
in
Source

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

View solution in original post

3 REPLIES 3
Asheesh
New Member

Thanks @AlB for your swift response. It's working 😀

AlB
Community Champion
Community Champion

@Asheesh 

See it all at work in the attached file

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

AlB
Community Champion
Community Champion

Hi @Asheesh 

Small change to your function:

(InputSal as number) =>
let
SingleRowSal = Table.SelectRows(#"SalaryGrades",each [Min Sal]<=InputSal and [Max Sal]>=InputSal),
Source = try SingleRowSal[Grade ID]{0} otherwise null
in
Source

 

SU18_powerbi_badge

Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.