Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Dynamically Change 'measure' name

Hi everyone,

I have a series of measures that calculate the current, current-1w...current-2w sales for the selected yearmonth. Based on an user selection, I would like the measures to display a different name. For example, if August is picked, the current value to show 'Current: 26/08/2024' (Last monday of August), the current-1w to show '-1W: 19/08/2024', etc.

I saw in this video (Dynamic name) how to use field parameters to change the measure name that the user sees, but I have realised that this works as a calculated column, and so the names change only when refreshing the data, not on filter selection/change. 

My current field parameter is looking like this:

Tracker Dynamic Fields = {
    ("Sales Full", NAMEOF('Tracker Measures'[Sales Touchpoint_0_EoM]), 0, "Full Month"),
    ("Sales " & FORMAT([Last Monday], "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_1_current]), 1, "0. Current Week: " & FORMAT([Last Monday], "dd/mm/yyyy")),
    ("Sales " & FORMAT([Last Monday]-7, "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_2]), 2, "1. -1 Week: " & (FORMAT([Last Monday] - 7, "dd/mm/yyyy"))),
    ("Sales " & FORMAT([Last Monday]-14, "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_3]), 3, "2. -2 Weeks: " & (FORMAT([Last Monday] - 14, "dd/mm/yyyy"))),
    ("Sales " & FORMAT([Last Monday]-21, "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_4]), 4, "3. -3 Weeks: " & (FORMAT([Last Monday] - 21, "dd/mm/yyyy"))),
    ("Sales " & FORMAT([Last Monday]-28, "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_5]), 5, "4. -4 Weeks: " & (FORMAT([Last Monday] - 28, "dd/mm/yyyy"))),
    ("Sales " & FORMAT([Last Monday]-35, "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_6]), 6, "5. -5 Weeks: " & (FORMAT([Last Monday] - 35, "dd/mm/yyyy"))),
    ("Sales " & FORMAT([Last Monday]-42, "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_7]), 7, "6. -6 Weeks: " & (FORMAT([Last Monday] - 42, "dd/mm/yyyy"))),
    ("Sales " & FORMAT([Last Monday]-49, "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_8]), 8, "7. -7 Weeks: " & (FORMAT([Last Monday] - 49, "dd/mm/yyyy"))),
    ("Sales " & FORMAT([First Monday], "dd mmm"), NAMEOF('Tracker Measures'[Sales Touchpoint_9]), 9, "8. -8 Weeks: " & FORMAT([First Monday], "dd/mm/yyyy"))
}

Are there any alternatives to this or does any idea come to mind? Would it be possible to trigger parameter refresh on filter selection change?

 

Thanks in advance!

  • Anonymous's avatar
    Anonymous
    1 year ago

    So, I ended up changing the names of the measures in the field parameter to remove all the FORMAT(...). I included a couple more columns to categorise them in measure type and what week each measure is looking to. I imported a support table with the dates I needed, giving them the name that I want to display, what category of week they belong too and I crossjoined that with the field parameter table.

    It looks great except... Now the order of the parameters is not dependant on the order you click the fields to include. Which I am trying to solve because I think it's a nice to have.

     

    But just in case that's not an issue for somebody, I would probably say this is the solution

3 Replies

  • Hi.

     

    This can't and definitely *shouldn't* be done imho.

     

    Imagine a user has selected July and -1 week. If the user then switches to August, the second selection should still be -1 week and not change to a value with a new date.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Exactly, that's why I mentioned that I didn't realize it worked as a calculated table and won't refresh with filter changes. I think this method is only useful with cases as the video.

       

      I'm wondering if there are any alternatives that may help my situation,

  • Anonymous's avatar
    Anonymous
    Not applicable

    So, I ended up changing the names of the measures in the field parameter to remove all the FORMAT(...). I included a couple more columns to categorise them in measure type and what week each measure is looking to. I imported a support table with the dates I needed, giving them the name that I want to display, what category of week they belong too and I crossjoined that with the field parameter table.

    It looks great except... Now the order of the parameters is not dependant on the order you click the fields to include. Which I am trying to solve because I think it's a nice to have.

     

    But just in case that's not an issue for somebody, I would probably say this is the solution