Forum Discussion
ashraf_K
2 years agoFrequent Visitor
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,...
- 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
barritown
Solution Sage
2 years agoHi ashraf_K,
I'd solve your task with a calculation column like this. The question is how to treat the date 29.03.2022, which appears somewhere in the middle.
In plain text:
Remaining =
VAR CurDate = [Purchase date]
VAR CurVessel = [Vessel Name]
VAR _tbl = FILTER ( Data, [Vessel Name] = CurVessel && [Purchase date] <= CurDate )
RETURN SUMX ( _tbl, [Required] ) - SUMX ( _tbl, [Purchased] )Best Regards,
Alexander
ashraf_K
2 years agoFrequent Visitor
Ideally it should be sorted by purchase date so that we can show how the purchase is progressing through time
- barritown2 years ago
Solution Sage
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
- ashraf_K2 years agoFrequent Visitor
Yes, that does solve the issues.
Thank you!