I need to calculate running total of forecast amount starting from maximum value, based on two stock locations and once for each product (product numbers are repetitive due to stock locations). e.g product no "1" should be used once for running total.
My first code, which didn't sum the same forecast amounts independently based on item no.
RunningTotal1 =
VAR
CurrentAmount= Listing[Forecast Amount]
RETURN
SUMX (
FILTER (
Listing;
Listing[Forecast Amount]>= CurrentAmount);
Listing[Forecast Amount])
My second code where running total was based on stock location, it calculates for each location independently still didn't sum the same forecast amounts independently based on item no.
RunningTotal2 =
VAR CurrentAmount = Listing[Forecast Amount]
VAR Location = Listing[Stock Location]
RETURN
SUMX (
FILTER (
Listing;
Listing[Stock Location] = Location &&
Listing[Forecast Amount]>= CurrentAmount);
Listing[Forecast Amount])
But when I add second location to my formula it gives an error.
"DAX comparison operations do not support comparing values of type Text with values of type True/False. Consider using the VALUE or FORMAT function to convert one of the values."
RunningTotal3 =
VAR CurrentAmount = Listing[Forecast Amount]
VAR LocationW = Listing[Stock Location] = "Warehouse"
VAR LocationT = Listing[Stock Location] = "Total Stock"
RETURN
SUMX (
FILTER (
Listing;
Listing[Stock Location] = LocationW ||
Listing[Stock Location] = LocationT &&
Listing[Forecast Amount]>= CurrentAmount);
Listing[Forecast Amount])
What I expect is
Hello @RADO,
I tried to add as measure but couldn't succeed therefore I added as a new column. I realize my code is wrong, in your image item no 5 and 6 have different number. my formula is
Forecast Index = RANKX(Listing;Listing[Forecast Amount])
here's the result Forecast Index
regards




