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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
antonio_wurth
Helper I
Helper I

dynamic parameters and names

hello 

 

general idea:

have a filter for "calendar_year"

 

when choosing some year, for example 2023

 

chart below should calculate

YTD for 2023

and YTD for 2022

legend should change to 2023 and 2022 as well

 

but for now

numbers - are changing(all good)

but legend always same 2024-2023(if if number are for 2023-222)

 

link to pbix file dynamic_names

 

 

antonio_wurth_0-1704368806096.png

 

help please

 

 

1 ACCEPTED SOLUTION
Ritaf1983
Super User
Super User

Hi @antonio_wurth 
This happens because your parameters are based on today and not on selected years.
So no matter what you choose, the parameter will be the year of today or previous to today.
As an alternative, you can use a disconnected years table and dynamic measure.

Ritaf1983_0-1704434272753.png

Dynamic_sales = if(ISFILTERED('dim_date'[calendar_year]),
 if(SELECTEDVALUE('Years'[Years])=max('dim_date'[calendar_year]),[sales_ytd],
if(SELECTEDVALUE('Years'[Years])=max('dim_date'[calendar_year])-1,[sales_ytd_py])),"")
Ritaf1983_1-1704434393433.png
Or just use The years of your date table as a legend with 1 measure
Ritaf1983_2-1704434565758.png

pbix is attached

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

View solution in original post

3 REPLIES 3
antonio_wurth
Helper I
Helper I

thank you!

You're welcome 🙂

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

Hi @antonio_wurth 
This happens because your parameters are based on today and not on selected years.
So no matter what you choose, the parameter will be the year of today or previous to today.
As an alternative, you can use a disconnected years table and dynamic measure.

Ritaf1983_0-1704434272753.png

Dynamic_sales = if(ISFILTERED('dim_date'[calendar_year]),
 if(SELECTEDVALUE('Years'[Years])=max('dim_date'[calendar_year]),[sales_ytd],
if(SELECTEDVALUE('Years'[Years])=max('dim_date'[calendar_year])-1,[sales_ytd_py])),"")
Ritaf1983_1-1704434393433.png
Or just use The years of your date table as a legend with 1 measure
Ritaf1983_2-1704434565758.png

pbix is attached

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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.