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
ZeinebDerbel
Frequent Visitor

How to use parameters in Power BI filters?

Hello,

 

I have a certain parameter that I want to use in Power BI filters, so that I can update a column (it's a custom column that switches columns depending on the parameter).

 

Is there a solution for that? 

 

Regards,

1 ACCEPTED SOLUTION

Hi @ZeinebDerbel ,

Based on my test, the query column seems work fine to create a dynamic columnm, you can remove initial columns in power query

pq.png

In addition, creating a calculated column cannot achieve because calculated column is a static column not dynamic, if you want to create a new table including language, you need to create a measure liek this and have a reference column in a table visual:

Result = 
IF(
    SELECTEDVALUE(Lang[Lang]) = "EN",
    SELECTEDVALUE('Table'[NameEN]),
    SELECTEDVALUE('Table'[Name])
)

measure.png

Attached my sample file that you can refer: How to use parameters in Power BI filters.pbix

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Pragati11
Super User
Super User

Hi @ZeinebDerbel ,

 

Can you please paste the calculation here for your calculated column which uses parameter in it?

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Hi,

 

The query for my column:

" Table.AddColumn(#"Changed Type", "DynamicColumn", each if Language = "EN" then [NameEN] else [Name])"

 

Language is the parameter I'm using.

 

Also, I tried another way, by making a new table with a column for language. But I'm having troubles with SELECTEDVALUE().

This is the DAX query for my column:

 

DynamicColumn = SWITCH(TRUE(),
SELECTEDVALUE(Langue[Lang])="EN",[NameEN],
[Name])
 
No changes when I select values in the filter.
 
Thanks,

Hi @ZeinebDerbel ,

Based on my test, the query column seems work fine to create a dynamic columnm, you can remove initial columns in power query

pq.png

In addition, creating a calculated column cannot achieve because calculated column is a static column not dynamic, if you want to create a new table including language, you need to create a measure liek this and have a reference column in a table visual:

Result = 
IF(
    SELECTEDVALUE(Lang[Lang]) = "EN",
    SELECTEDVALUE('Table'[NameEN]),
    SELECTEDVALUE('Table'[Name])
)

measure.png

Attached my sample file that you can refer: How to use parameters in Power BI filters.pbix

 

Best Regards,
Yingjie Li

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

Hi,

 

Yes thank you!

This works perfectly.

 

Regards,

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.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

Top Solution Authors