Forum Discussion

antonio_wurth's avatar
2 years ago
Solved

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

 

 

 

help please

 

 

  • 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.

    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])),"")
    Or just use The years of your date table as a legend with 1 measure

    pbix is attached

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

3 Replies

  • 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.

    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])),"")
    Or just use The years of your date table as a legend with 1 measure

    pbix is attached

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