Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Dipti123
Contributor III
Contributor III

Partial sum in incorrect for table

Dipti123_0-1759916873419.png

I have this table where i want to show on first day of month the cumulative amount 

below expression i Used but i gives me incorrect total 

If(
Date([Data ordine]) = MonthStart(Today()) and
Month([Data ordine]) = Month(Today()) and
Year([Data ordine]) = Year(Today()),

Sum(Total If(
Archivio = 'O' and
Date([Data ordine]) <= MonthStart(Today()) and
Month([Data consegna]) = Month(Today()) and
Year([Data consegna]) = Year(Today()),
Importo
)),
Sum({<Archivio = {'O'}>} Importo)
)



in fonrt of 01/10/2025 it is sgowing correct value but its doesnot add it in partial sum wha is solution to this 
Please help ?



Labels (1)
14 Replies
Dipti123
Contributor III
Contributor III
Author

Okay .Thank you @marcus_sommer 

Dipti123
Contributor III
Contributor III
Author


Could you please confirm ?
@PrashantSangle 

 

Dipti123
Contributor III
Contributor III
Author

@marcus_sommer  As per the link you shared I studied the post 


FirstOrderDatePerMonth:
LOAD
Year([Data ordine]) AS YearDel,
Month([Data ordine]) AS MonthDel,
Min([Data ordine]) AS FirstOrderDate
RESIDENT FATTI
WHERE Archivio = 'O'
GROUP BY
Year([Data ordine]),
Month([Data ordine]);


Deliveries_Cumulative:
LOAD
[Data ordine],
[Data consegna],
Importo,
Archivio,
Year([Data ordine]) AS YearDel,
Month([Data ordine]) AS MonthDel
RESIDENT FATTI
WHERE Archivio='O';

JOIN (Deliveries_Cumulative)
LOAD
YearDel,
MonthDel,
FirstOrderDate
RESIDENT FirstOrderDatePerMonth;


Deliveries_Daily:
LOAD
[Data ordine],
[Data consegna],
'Daily' AS RecordType,
SUM(Importo) AS Importo_Result
RESIDENT FATTI
WHERE Archivio='O'
GROUP BY
[Data ordine],
[Data consegna];


Cumulative_Result:
LOAD
FirstOrderDate AS [Data ordine],
MonthStart([Data consegna]) AS [Data consegna],
'Cumulative' AS RecordType,
SUM(Importo) AS Importo_Result
RESIDENT Deliveries_Cumulative
WHERE [Data ordine] <= FirstOrderDate
GROUP BY FirstOrderDate, MonthStart([Data consegna]);


DROP TABLE FirstOrderDatePerMonth, Deliveries_Cumulative;
EXIT SCRIPT;

is this correct ?

Thanks

Dipti Ahire

marcus_sommer

It seems to be a transfer of the logic from the UI to the data-model - which is more as above hinted - but if it could be done here it should be done there. But I could not justify if it's working against your data-set and requirements.

PrashantSangle

any error are you getting after that.. I lost between brackets of that expression.

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂