Forum Discussion

StevenT's avatar
StevenT
Helper V
1 year ago
Solved

Using drop down to change date settings in chart

Hi, I have two charts. The y-axis contains numerical values, and x-axis is a date hierarchy that contains the following from my calendar table

Each one of these fields in the hierarchy are date fields, 
When I manually drill through in each of these charts I get the charts changing from month quarter and year. As expected.
Going forward I will have additional charts. each one will be using the same hierarchy.

Is there a way to create a way that a user can simply choose any of the three from a drop down and each selection, the charts change so the Y-axis changes from Month, quarter and year?

i tried it by using this code and then putting the first parameter in a drop down to choose, but my code is being ignored.

_X-Axis =
 //used only in the Calendar Drop down
 {
    ("Annually", NAMEOF('Calendar'[Start of Year]), 0),
    ("Monthly", NAMEOF('Calendar'[Start of Month]), 1),
    ("Quarterly", NAMEOF('Calendar'[Start of Quarter]), 2)
}


Any suggestions would be appreciated...
Thanks, Steve.

 

 

 

  • Hi! When you create the below did you use the New parameter then fields from the Modeling ribbon or did you just type this directly in a new table? 

    i tried it by using this code and then putting the first parameter in a drop down to choose, but my code is being ignored.

    _X-Axis =
     //used only in the Calendar Drop down
     {
        ("Annually"NAMEOF('Calendar'[Start of Year]), 0),
        ("Monthly"NAMEOF('Calendar'[Start of Month]), 1),
        ("Quarterly"NAMEOF('Calendar'[Start of Quarter]), 2)
    }
  • StevenT's avatar
    StevenT
    1 year ago

    No, I just created it without adding any parameters against it.  I'll give it a try.

     

  • StevenT's avatar
    StevenT
    1 year ago

    Audrey, thanks so much! The key was creating it with the field parameter.  I tried importing the code from another app, and simply pasting it, changing the field names.  I forgot that this was created with field parameters

  • You are very welcome! Happy I could help (guess how I suspected you pasted the code... been there done that 😂). Have a great weekend!

4 Replies

  • Hi! When you create the below did you use the New parameter then fields from the Modeling ribbon or did you just type this directly in a new table? 

    i tried it by using this code and then putting the first parameter in a drop down to choose, but my code is being ignored.

    _X-Axis =
     //used only in the Calendar Drop down
     {
        ("Annually"NAMEOF('Calendar'[Start of Year]), 0),
        ("Monthly"NAMEOF('Calendar'[Start of Month]), 1),
        ("Quarterly"NAMEOF('Calendar'[Start of Quarter]), 2)
    }
    • StevenT's avatar
      StevenT
      Helper V

      No, I just created it without adding any parameters against it.  I'll give it a try.

       

    • StevenT's avatar
      StevenT
      Helper V

      Audrey, thanks so much! The key was creating it with the field parameter.  I tried importing the code from another app, and simply pasting it, changing the field names.  I forgot that this was created with field parameters

      • audreygerred's avatar
        audreygerred
        Super User

        You are very welcome! Happy I could help (guess how I suspected you pasted the code... been there done that 😂). Have a great weekend!