Forum Discussion

edge9999's avatar
edge9999
Frequent Visitor
1 year ago

Running Total for Charges

I have a faily simple problem (I think) that i just cant get my head around.   We have numerous transaction lines, each with a dollar amount and a truck associated wtih them.    I'm trying to do a quick matrix where the Revenue per truck is summed up (easy part), and then the fees for that truck are calculated.    If the revenue is 25-150K the Fee is $300, if the Revenue is Greater than 150K, the fee is $500 (can also display this).   But the part i can't get is a total of the fees.   I need seom sort of running total on the column titled total in the matrix shown below.    I think i understand why the totals for the 25-150k and Over 150K columns dont work, but i just need to get some way to come up with the total fee and display it.   Any feedback is appreciated.

 

 

Formulas in columns 1, 2 and 3 repectively

MS_LINE_AMOUNT = sum(VW_TICKET_LINEITEMS[AMOUNT])
MS_25_150K = if([MS_LINE_AMOUNT] > 25000 && [MS_LINE_AMOUNT] <= 150000,300,0)
MS_OVER150K = if([MS_LINE_AMOUNT] > 150000 ,500,0)
 
 

 

6 Replies

  • Consider using a Quick Measure for that. It has a "Running Total"  pattern that is pretty solid.

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, edge9999 

     

    You can try the following methods.

     

    Measure 25_150K = SUMX(VW_TICKET_LINEITEMS,[MS_25_150K])
    Measure OVER150K = SUMX(VW_TICKET_LINEITEMS,[MS_OVER150K])
    Measure Total = [Measure 25_150K]+[Measure OVER150K]
    Total = SUMX(FILTER(ALL(VW_TICKET_LINEITEMS),[Unit]<=MAX(VW_TICKET_LINEITEMS[Unit])),[Measure Total])

     

    Is this the result you expected?

     

    Best Regards,

    Community Support Team _Charlotte

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

  • HI edge9999 ,

     

    you can try this formula to find running total for charges

    running total = 
    var current_unit = MAX(VW_TICKET_LINEITEMS[Unit])
    RETURN
    CALCULATE(SUMX(FILTER(ALL(VW_TICKET_LINEITEMS),
                          VW_TICKET_LINEITEMS[Unit] <= current_unit),[Total Charges]))

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