Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Reset weekly costs

Hey i have a little problem with server data. New cost entries in rows are summing even the previous rows value. Can someone help me with formula for measure that i could present the data with days/ month/ year in charts?

 

The values need to be reseted every month or the current month to be subtracted by previous. so i could present it normally ( that is the main problem). 

 

 

Current costs are calculated by taken smallest cost from each distinct id and subtracted by each counted new cost entrie

Current Cost =
'pl_master_data supla_sensor'[totalCost] - 'pl_master_data supla_sensor'[Constant value]

 

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Here I suggest you to try this code to create a calculated column.

    Current Cost =
    VAR _Constant_Value =
        CALCULATE (
            MIN ( 'pl_master_data supla_sensor'[totalcost] ),
            ALLEXCEPT ( 'pl_master_data supla_sensor', 'pl_master_data supla_sensor'[ID] )
        )
    RETURN
        'pl_master_data supla_sensor'[totalcost] - _Constant_Value

    Result is as below.

     

    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.

  • Anonymous's avatar
    Anonymous
    Not applicable

    It returns the same values when i reseted everything to 0, just like in the column [Current Cost] The data will still contain value from previous rows. For example, Row 2276 needs to be subtracted by previous entry 2272. The calculation will give costs for inbetween  the minutes of both entries