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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
TufaZ
New Member

Is there any way to choose the columns within a parameter dynamically?

Hello everyone!  Can you please help me?

 

I have a table that contains the sales value from 2019 until 2022 and I want to create a parameter that contains all the years since 2019 until the previous year. So in 2024, the paremeter includes 2023 automatically.

 

For example, let's considere the following sales table.

 

TufaZ_0-1691533480419.png

 

The final objetive is to have a filter with the list of years using the parameter and to show the selected years as columns in the table as we can see in the next image.

TufaZ_2-1691533926895.png

 

Has anyone ever done something like this?

 

I've already seached for a solution but I couldn't found it.

 

Thank you!

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi, @TufaZ 

According to your description, you want to create a slicer to filter the columns in the visual.

Here are teh steps you can refer to :
(1)We need to create three measures to calculate every year value.

Sals 2020 = CALCULATE( SUM('Table'[Sales]) , 'Table'[Year]=2020)
Sals 2021 = CALCULATE( SUM('Table'[Sales]) , 'Table'[Year]=2021)
Sals 2022 = CALCULATE( SUM('Table'[Sales]) , 'Table'[Year]=2022)
 
(2)Then we can create a field parameter in Desktop:
vyueyunzhmsft_0-1691632607117.pngvyueyunzhmsft_1-1691632618761.png

 

Then we can modify the [Parameter] to this:

vyueyunzhmsft_2-1691632640281.png

Then we can put the [Value4] to the slicer and put the [Paramter] to the value and we can meet your need:

vyueyunzhmsft_3-1691632677512.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

1 REPLY 1
v-yueyunzh-msft
Community Support
Community Support

Hi, @TufaZ 

According to your description, you want to create a slicer to filter the columns in the visual.

Here are teh steps you can refer to :
(1)We need to create three measures to calculate every year value.

Sals 2020 = CALCULATE( SUM('Table'[Sales]) , 'Table'[Year]=2020)
Sals 2021 = CALCULATE( SUM('Table'[Sales]) , 'Table'[Year]=2021)
Sals 2022 = CALCULATE( SUM('Table'[Sales]) , 'Table'[Year]=2022)
 
(2)Then we can create a field parameter in Desktop:
vyueyunzhmsft_0-1691632607117.pngvyueyunzhmsft_1-1691632618761.png

 

Then we can modify the [Parameter] to this:

vyueyunzhmsft_2-1691632640281.png

Then we can put the [Value4] to the slicer and put the [Paramter] to the value and we can meet your need:

vyueyunzhmsft_3-1691632677512.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors