I have been trying to understand why the code acts this way for a while now but cant understand.
Filter(
LagerFysiskaPlatsers;
StartsWith(Lagerplats; Text(varChosenLager));
StorlekLagerPlatsAm>Sum(Filter('LagerLoggedItems';LagerPlats = LagerFysiskaPlatsers[@Lagerplats]);SizeOfPallAm))
I am trying to compare the size of StorlekLagerPlatsAm to the Sum size of all SizeOfPallAm with the same Lagerplats in both tables. What is strange is that if i encase either the Sum part or StorlekLagerPlatsAm within Value() then the code works perfectly fine, but with a delegation warning since it goes thru the whole database to find the result. It also works if I encase the whole code within an If() and set the result as StorlekLagerPlatsAm, but again with a delegation warning.
This wouldnt be an issue if it was a smaller database i was working with, I would have just accepted the delegation warning. But it performs terribly slow when it activly converts to a Value since it then has to first read the the database and then set the result.
Any ideas on why it doesnt work with the code unless i convert it within a Value() or If()? In the Dataverse database both StorlekLagerPlatsAm and SizeOfPallAm are numerical columns.