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
Syndicate_Admin
Administrator
Administrator

Create table from another with a dynamic variable

Good morning, I would like to guide me how to create a table from another with filter but the new table has a dynamic variable in the filter.

I attach the following example:

I have a table with sales fields, months and years. The report shows me the table with the fields described with a segmentation of years. The measure [annio] captures the selected year value.
And I want to get a new table according to:

Tabla_Filtro_medida =

var aniio = [annio]

var table = filter(Sales, Sales[Year]=aniio)

return table

where [annio] = SELECTEDVALUE(Sales[Year])

however the table comes out blank

If I change the variable aniio by a constant number, there if I get the table ... for example create the tabla_Filtro_valor according to

Tabla_Filtro_valor = filter(Sales, Sales[Year]=2010)

As you will see, the problem is just in the dynamic variable. How can I make it work.? ..... Note that the objective is to create the table so that the variable is dynamic.

Thank you very much for your help.

Best regards

Juan Suyon

9 REPLIES 9
Syndicate_Admin
Administrator
Administrator

Thanks a lot!

Syndicate_Admin
Administrator
Administrator

I explain the problem..... I have a multi-year sales table from different clients...... I want to get the top 20 sales per customer dynamically.... that is, with a year filter that shows me the table of the first 20 cleintes for that year. As the year is in a segmentation, the idea is to obtain this table every time the year varies.

That's why I tried to create the table with the dynamic variable but I understand that you can't..... Would there be another way to get what I am looking for dynamically?

Thank you

You do that via RANKX() and then TOPN(20,...)

Syndicate_Admin
Administrator
Administrator

OK, thanks!!! .... Consultation, how could I do it otherwise, that is, what option would there be?

Thank you!

JUan Suyon

What are you planning to do with that resulting table?

Hello, I plan to apply the Topn function

Thank you

Best regards

I meant: What business question are you trying to answer?

lbendlin
Super User
Super User

You cannot create a calculated column or calculated table from a measure.

Syndicate_Admin
Administrator
Administrator

Good day, any suggestions or opinions if you can or not?

Thank you

Juan Suyon

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors