Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
So I wanted to roll up the entitlement consumption in the consumption monitor to see at what point in month we reached 50%/75% of our capcity.
I'm just tacking this on the end so as not to interfere with the usual QVD incremental load, however it seems to be duplicating rows and not summing as expected.
I first create a table that sums the CapacityUsed by Date & AppID , then use Peek.
[Cumulative]:
NoConcatenate
LOAD
appId,
MonthStart( Date(Timestamp#(endTime, 'YYYY-MM-DDThh:mm:ss.fffZ'))) AS CMLMonth,
Date(Timestamp#(endTime, 'YYYY-MM-DDThh:mm:ss.fffZ')) AS DateOnly, // Extracts date portion from endTime
Sum(capacityUsed) AS TotalCapacityUsed
RESIDENT Entitlement_Consumption
GROUP BY appId, Date(Timestamp#(endTime, 'YYYY-MM-DDThh:mm:ss.fffZ')), MonthStart( Date(Timestamp#(endTime, 'YYYY-MM-DDThh:mm:ss.fffZ')));
[MonthlyCumulative]:
NoConcatenate
LOAD
appId,DateOnly as CMLDate,
CMLMonth,
// Get the month start for grouping by month
If(CMLMonth = Peek('CMLMonth')AND appId = Peek('appId'),
Peek('CumulativeCapacityUsed') + TotalCapacityUsed,TotalCapacityUsed) AS CumulativeCapacityUsed // Calculate cumulative sum
RESIDENT [Cumulative]
ORDER BY DateOnly,appId, CMLMonth;
Drop Table Cumulative;
What I should eventually get is akin to the below
However it doesn't seem to be accumulating
Thanks @Kushal_Chawda - that worked - I can now highlight where the running sum intersects the threshold. Great stuff, and thanks again for your help!
As below- conditional colouring where intersections hit:-