Forum Discussion

ManishaDeval_05's avatar
ManishaDeval_05
Regular Visitor
1 year ago
Solved

Trend Sorting

I have created a measure on the trend sorting and i have alligned on the basis of down arrows will come first and up arrow which is good will come last on the basis of units and i have 10 slicer and ...
  • bhanu_gautam's avatar
    1 year ago

    ManishaDeval_05 

    Create Measures: Ensure that your measure for trend sorting is dynamic and responds to slicer selections. You can use DAX functions like SELECTEDVALUE or ALLSELECTED to capture the slicer values.

     

    Sort Logic: Implement the sorting logic within your measure. For example, you can use SWITCH or IF statements to determine the sorting order based on the trend direction (down arrow first, up arrow last).

     

    Apply Sorting: Use the measure to sort your visual. In Power BI, you can set the sort order of a visual based on a measure.

     

    DAX
    TrendSortMeasure =
    VAR SelectedSlicer1 = SELECTEDVALUE(SlicerTable1[Column1])
    VAR SelectedSlicer2 = SELECTEDVALUE(SlicerTable2[Column2])
    -- Add more slicer variables as needed
    VAR TrendDirection = IF([TrendMeasure] < 0, 1, 2) -- 1 for down arrow, 2 for up arrow
    RETURN
    TrendDirection +
    IF(SelectedSlicer1 = "Value1", 0,
    IF(SelectedSlicer1 = "Value2", 10, 20)) +
    IF(SelectedSlicer2 = "ValueA", 0,
    IF(SelectedSlicer2 = "ValueB", 5, 10))
    -- Add more conditions for other slicers