Hello again,
Kindly assist with this: I would like to sum sales when the previous row is smaller than the row below it.
in the image attached, 3479 is smaller than the immediate row below it 5361 so the expression should calculate the sum.
Sum(SELECT(
Sales[Diesel Liter Sales],
[Timestamp] >= MAX(
SELECT(
Sales[Timestamp],
([Diesel Opening Dipstick] >[Most Recent].[Diesel Opening Dipstick] )))))
my expression is giving me an error of unable to find the column โ[Diesel Opening Dipstick]โ of [Most Recent].[Diesel Opening Dipstick].
thanks.
Your request is unclear, but hereโs something:
IFS(
(
LOOKUP(
MAX(
SELECT(
Sales[_ROWNUMBER],
([_THISROW].[_ROWNUMBER] > [_ROWNUMBER])
)
),
"Sales",
"_ROWNUMBER",
"Diesel Liter Sales"
)
<
[Diesel Liter Sales]
),
(
LOOKUP(
MAX(
SELECT(
Sales[_ROWNUMBER],
([_THISROW].[_ROWNUMBER] > [_ROWNUMBER])
)
),
"Sales",
"_ROWNUMBER",
"Diesel Liter Sales"
)
+
[Diesel Liter Sales]
)
)
Hi Steve,
sorry for not being clear.
I am trying to sum all Diesel Liter Sales from Sales Table when the immediate row below value is higher than its above row value. The idea is I want to start summing when there is an increase in stock due to new delivery.
the summing point of Diesel Liter Sales begins at the row that is parallel with the bigger value (5361) which is when the new stock arrives.
hope I make it clearer.
much thanks
Where would the answer be saved?
Hi Steve,
From your suggested expressions, I have temporarily got an accurate result by creating it in VC and a VC for the previous row that deducting the previous from the total sum.
the challenge is still to save in my Order Table and also stop the sum when a new immediate row below value is higher than its above row value.
IFS(
(
LOOKUP(
MAX(
SELECT(
Sales[_ROWNUMBER],
([_THISROW].[_ROWNUMBER] > [_ROWNUMBER])
)
),
โSalesโ,
โ_ROWNUMBERโ,
โDiesel Liter Salesโ
)
<
[Diesel Liter Sales]
),
(
LOOKUP(
MAX(
SELECT(
Sales[_ROWNUMBER],
([_THISROW].[_ROWNUMBER] > [_ROWNUMBER])
)
),
โSalesโ,
โ_ROWNUMBERโ,
โDiesel Liter Salesโ
)
+
Sum(Select(Sales[Diesel Liter Sales],[Timestamp]>=[_Thisrow].[Timestamp]))
)
)-[Previous Diesel Liter Sales]
While this looks like an interesting academic challenge, I donโt see any good way to do what you want. I encourage you to consider alternative approaches.
I have another Table (Order[Diesel Liter Sales]
Thanks Steve for your time in itโฆ I have considered doing it thru an automatic action. so that i could always check the new delivery if arrives and get the calculation immediately than looking for a needle in haystack. glad to practice though and squeezed drain my brain.
User | Count |
---|---|
41 | |
29 | |
22 | |
20 | |
15 |