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
akhaliq7
Post Prodigy
Post Prodigy

M Language: Access an element of a parameter list while filtering by text

Would like to filter by three elements in my parameter list:

 

parameter list

departments: admin, sales, marketing

 

m language:

= Table.SelectRows(#"Changed Type", each ([Department] = ? or [Department] = ? or [Department] = ?))

 

for example, when coding in javascript I would use:

 

department[0]

department[1]

department[2]

 

what can I use in M language?

 

also don't want to hardcode as the values may change in the future in the parameter list

1 ACCEPTED SOLUTION
akhaliq7
Post Prodigy
Post Prodigy

For my specific issue this can solved by using the or and creating more than one parameter, or in my case I created one parameter and hardcoded one value as that extra value was only to be used in one report,

= Table.SelectRows(#"Changed Type",each ([Department] = Department or [Department] = "Admin"))

View solution in original post

3 REPLIES 3
akhaliq7
Post Prodigy
Post Prodigy

For my specific issue this can solved by using the or and creating more than one parameter, or in my case I created one parameter and hardcoded one value as that extra value was only to be used in one report,

= Table.SelectRows(#"Changed Type",each ([Department] = Department or [Department] = "Admin"))

Ritaf1983
Super User
Super User

Hi @akhaliq7  please refer to the linked tutorial, it seems exactly what you need:

https://www.youtube.com/watch?v=gFqlfSckc5s

If this post helps, then please consider Accepting it as the solution to help the other

members find it more quickly

Regards,
Rita Fainshtein | Microsoft MVP
https://www.linkedin.com/in/rita-fainshtein/
Blog : https://www.madeiradata.com/profile/ritaf/profile

This is not what I would like to achieve, I am looking for syntax that I can then use in my M Language, e.g. if I could access elements 2 & 3 in the parameter list which is  sales and marketing I would like to change my m language to be the following:

m language:

= Table.SelectRows(#"Changed Type", each ([Department] = Department[1] or [Department] = Department[2]  ))

 

Parameter List

 

Department

Values

    Admin

    Sales

    Marketing

 

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.