Forum Discussion

ashraf_K's avatar
ashraf_K
Frequent Visitor
2 years ago
Solved

Running Difference per day and name

Below is a sample data that is being used. The requirement is to calculate the remaining for each row by substracting it from the previous line. Basically for  10 Oct it is easily calculated,...
  • barritown's avatar
    barritown
    2 years ago

    Then, something like on the screenshot below. The table visual allows sorting by multiple columns if you hold SHIFT key.

    In plain text:

    Remaining = 
    VAR CurDate = [Purchase date]
    VAR CurVessel = [Vessel Name]
    VAR _tbl = FILTER ( Data, [Vessel Name] = CurVessel && [Purchase date] <= CurDate )
    RETURN SUMX ( FILTER ( Data, [Vessel Name] = CurVessel ) , [Required] ) - SUMX ( _tbl, [Purchased] )

    Best Regards,

    Alexander

    My YouTube vlog in English

    My YouTube vlog in Russian