Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Distribute grouped values for periods of daily values

Hello everyone, I need your help to spread the values that are part of a range of dates, to daily values.
Enclosed is an example of what I'd need.
my data source is a single file QVD with the fields as in the Excel.
To consider that my total assets are about 450.
Thanks to those who can help me

14 Replies
Not applicable
Author

I solved by adding a where clause after the first load:


Table:

LOAD asset,

     Date(Floor(data)) as date,

     delta

FROM

(ooxml, embedded labels, table is Sheet1)

WHERE(delta <> '0');

in this way the calculation is performed without considering the deltas equal to zero.
It remains a small problem for the first readings of each asset which are also zero but should be considered (min (dates) group by assets)





sunny_talwar

What is the issue?

It remains a small problem for the first readings of each asset which are also zero but should be considered (min (dates) group by assets)

sunny_talwar

Try this:

Table:

LOAD asset,

    Date(Floor(data)) as date,

    delta

FROM

[targhe2.xlsx]

(ooxml, embedded labels, table is Sheet1);

tmpTable:

LOAD *

Where Not(delta = 0 and Flag > 1);

LOAD *,

  AutoNumber(RecNo(), asset) as Flag,

  Date(If(asset = previous(asset), Peek('date') + 1, date)) as startdate

Resident Table

Order By asset, date;

FinalTable:

LOAD Date(startdate + IterNo() - 1) as date,

  delta/(date - startdate + 1) as value,

  asset

Resident tmpTable

While startdate + IterNo()-1 <= date;

DROP Tables Table, tmpTable;

Not applicable
Author

you were really nice and helpful.

Sorry if I was not very precise in directions

sunny_talwar

No worries