Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Field Parameters_ Sorting the visual based on measure and in ascending order issue in bar chart

Hi All, I have created field parameters and using them in my clustered bar chart for both x-axis and y-axis. On y axis I have taken dimensions related field parameters and on x-axis I have taken mea...
  • speedramps's avatar
    1 year ago

    When you create field parameter it creates a table with hidden columns

    You can view these in the view hidden menu

     

    X measure  parameters = {
        ("Quantity", NAMEOF('Dax'[Quantity]), 0),
        ("Value", NAMEOF('Dax'[Value]), 1),
        ("Freight", NAMEOF('Dax'[Freight]), 2)
    }

     

    The "order" column controls what sequence the field parameters appear in the slicers and headers. 

    We can capture and use this field to contol the sort sequence of your clustered bar chart.

     

    Create measure.

    Sorter = 
    VAR Xoption = SELECTEDVALUE('X measure  parameters'[X measure  parameters Order])
    RETURN
    SWITCH(Xoption,
        0,[Quantity],
        1,[Value],
        2, [Freight]
    )

    The SELECTEDVALUE gets the  selected "order" for the measure you picked on the slicer.

    The SWITCH then gets the equivalent measure value

     

    Add the Sorter to your your clustered bar chart as tootltip.

    The click on three dots [...], Sort axis, Sorter, Descending

     

    Change the measure to handle multiple selections if required, so it slected you prefered measure sort sequence.

     

    Please click [accept solution] and thumbs up buttons to show your appreciation.