Forum Discussion

lboldrino's avatar
lboldrino
Resolver I
5 years ago
Solved

Sum Row by Row with sort Value over Col

i need  to calcute sum MSR count Tickets row by rows. 

0,5h = 326

1 h must be 326 + 227 = 526

how can i calcute sum my rows with order value as sort asc?  the table is sorted by value order

here is my measure, but this ignore my sort col "order"

 

MRS Running Total = 
var _ResolvesClsuter = [MSR count tickets]  

return 
sumx(filter(SUMMARIZE(allselected(fact_ticket_stats),dim_resolvetime_cluster[resolvetime_cluster_key],
"Tickets", [MSR count tickets]),
[Tickets] >= _ResolvesClsuter ),
[Tickets])

 

  • The formula below should work for your model.

     

    MRS Running Total =
    VAR currDisplayValue =
    MAX ( 'dim_resolvetime_cluster'[Order] )
    VAR result =
    CALCULATE (
    [MSR Count Tickets],
    ALL ( 'dim_resolvetime_cluster' ),
    'dim_resolvetime_cluster'[Order] <= currDisplayValue
    )
    RETURN
    IF ( HASONEFILTER ( dim_resolvetime_cluster[Display] ), result, BLANK () )

     

4 Replies

  • MikeJohnsonZA's avatar
    MikeJohnsonZA
    Responsive Resident

    Hi

     

    Its not clear what you underlying model looks like but I have assumed that your 'dim_resolvetime_cluster' table has a column for the order and that this is not a measure. the following measure should work for you once you update with the appropriate column and table names

     


    MRS Running Total =
    VAR currDisplayValue = MAX ( 'Fact_ticket_stats'[Order] )
    VAR result =
    CALCULATE (
    SUM ( Fact_ticket_stats[MSR Count Tickets] ),
    ALL ( 'Fact_ticket_stats' ),
    'Fact_ticket_stats'[Order] <= currDisplayValue
    )
    RETURN
    IF ( HASONEFILTER ( Fact_ticket_stats[Display] ), result, BLANK () )

     

    • lboldrino's avatar
      lboldrino
      Resolver I

      order is not a measure but [MSR Count Tickets] is a measure. 

       

      and Disply_name and order are in a dim_table and Tickets are in a fact_table (count of tickets )

       

      • MikeJohnsonZA's avatar
        MikeJohnsonZA
        Responsive Resident

        The formula below should work for your model.

         

        MRS Running Total =
        VAR currDisplayValue =
        MAX ( 'dim_resolvetime_cluster'[Order] )
        VAR result =
        CALCULATE (
        [MSR Count Tickets],
        ALL ( 'dim_resolvetime_cluster' ),
        'dim_resolvetime_cluster'[Order] <= currDisplayValue
        )
        RETURN
        IF ( HASONEFILTER ( dim_resolvetime_cluster[Display] ), result, BLANK () )