Forum Discussion

SAMUEL_KIARIE's avatar
SAMUEL_KIARIE
Frequent Visitor
3 years ago
Solved

Order by with Summarise

How do I order by Date;
Which is the best concept to create a table & order by  Sk_Date  asc?

Sales_Table = SUMMARIZE(Fct_Sale_Item,
        DIM_Date[sk_date],
         DIM_Date[cod_year],
         DIM_Date[COD_WEEK],
        Dim_Product[SKU Simple],
        "unit price",sum(Fct_Sale_Item[Unit Selling Price]))

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  SAMUEL_KIARIE ,

    There is no sort option in summarize function, you can find that table in Date view interface and sort the field [sk_date] as the below screenshot after the calculated table created.

    In addition, please review the following links and check if it can used as an workaround.


    SUMMARIZE does not include sorting. It just creates a table. If you want to create a physical table, you can sort the actual table using the table interface and/or the " Sort column by" in the ribbon. 
    HOWEVER, this sorting order of a physical table is only relevant to sorting fields in visuals. Measures are oblivious to this, since they return scalar values based on row/filter context and not tables. 
    To establish an order relevant to measures, you either create a calculated column in the physical table (which will however remain static) using RANK.EQ or RANKX, or you create a measure to rank values using RANKX (which can be dynamic)

    Best Regards

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  SAMUEL_KIARIE ,

    There is no sort option in summarize function, you can find that table in Date view interface and sort the field [sk_date] as the below screenshot after the calculated table created.

    In addition, please review the following links and check if it can used as an workaround.


    SUMMARIZE does not include sorting. It just creates a table. If you want to create a physical table, you can sort the actual table using the table interface and/or the " Sort column by" in the ribbon. 
    HOWEVER, this sorting order of a physical table is only relevant to sorting fields in visuals. Measures are oblivious to this, since they return scalar values based on row/filter context and not tables. 
    To establish an order relevant to measures, you either create a calculated column in the physical table (which will however remain static) using RANK.EQ or RANKX, or you create a measure to rank values using RANKX (which can be dynamic)

    Best Regards