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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

View solution in original post

3 REPLIES 3
antonio_wurth
Helper I
Helper I

thank you!

You're welcome 🙂

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.