Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
nareshthavidishetty
Creator III
Creator III

Logic to get day level data from MTD

Hi,

We have an excel source data with out date field as below

Data on:5/17/2016

WarehouseTotalCost
132102701.3
150178464.6
144123523.4

Data on 5/16/2016

WarehouseTotalCost
132202701.3
150478464.6
144723523.4

Here the MTD value is sum(TotalCost) will get MTD sales

To get daily sales as mathematically we need to do today MTD sales - Yesterday MTD sales will give Today sales.

We need to do this in qlikview at script level,but my excel source don't have any date field.

Thanks..

1 Reply
swuehl
MVP
MVP

You can probably create a additional date field  DateField from the FileBaseName() or FileTime() when loading in your excel files (or maybe using Today()).

https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/Scripting/FileFunctions/file-fun...

The concatenate all your data into one table and do a resident LOAD like

LOAD Warehouse, TotalCost, DateField,

          Rangesum(TotalCost, -If(Peek('Warehouse')=Warehouse, Peek('TotalCost'))) as DailyCost

RESIDENT YourTable

ORDER BY Warehouse, DateField asc;

DROP TABLE YourTable;

edit: Dropped the original table