Forum Discussion

pborah's avatar
pborah
Solution Sage
5 years ago
Solved

Sort by another column not working.

I'm not sure of the issue as I'm not getting any errors. However I'm unable to sort by another column. Data is in import mode and I'm using an SQL query to pull the data. My categories/bins are creat...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi pborah 

    I build a sample table to have a test.

    I think you can build two measures to achieve your goal.

    In your screenshot I think Hold Time Cumulative has been impacted by the sort column. 

    Hold Time Block = 
    SWITCH (
        TRUE (),
        'Table'[Min] <= 5, "Under 5 Minutes",
        'Table'[Min] <= 8, "Under 8 Minutes",
        'Table'[Min] <= 10, "Under 10 Minutes",
        'Table'[Min] <= 11, "Under 11 Minutes",
        'Table'[Min] <= 12, "Under 12 Minutes",
        'Table'[Min] <= 13, "Under 13 Minutes",
        'Table'[Min] <= 14, "Under 14 Minutes",
        "Over 14 Minutes"
    )
    Hold Time Sort = 
    SWITCH (
        TRUE (),
        'Table'[Hold Time Block] = "Under 5 Minutes",1,
        'Table'[Hold Time Block] = "Under 8 Minutes",2,
        'Table'[Hold Time Block] = "Under 10 Minutes",3,
        'Table'[Hold Time Block] = "Under 11 Minutes",4,
        'Table'[Hold Time Block] = "Under 12 Minutes",5,
        'Table'[Hold Time Block] = "Under 13 Minutes",6,
        'Table'[Hold Time Block] = "Under 14 Minutes",7,
        8
    )

    Measure:

    Count of Report ID = CALCULATE(COUNT('Table'[Report ID]))
    Report Cumulative Count = 
    SUMX(FILTER(ALL('Table'),'Table'[Hold Time Sort]<=MAX('Table'[Hold Time Sort])),[Count of Report ID])

    And you can sort the visual by Report Cumulative Count column. I try to add the sort column in this viausl and let it don't summarize, and the result shows correctly.

    If this reply still couldn't solve your problem, please show me your data model(Without sensitive data), and tell your calculate logic about the Cumulative column. 

    You can download the pbix file from this link: Sort by another column not working

    Best Regards,

    Rico Zhou

     

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