Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hello,
I am trying to calculate the evolution of my stock.
I want to create a new column where the first row will be Custom.Free space + Out.
The next row will be the result of the previous row + Out.
With this I want to se the evolution of my free space (Custom.Free space) day after day with the toal of stock going out (Out).
Thank you for your help !
Solved! Go to Solution.
You can try something like this as a calculated column:
Column =
VAR curDate = Table[Week day]
VAR firstCustomFreeSpace = CALCULATE(SELECTEDVALUE(Table[Custom.Free space]), FILTER(ALL(Table), Table[Week day] = MIN(Table[Week day])))
RETURN
firstCustomFreeSpace + SUMX(FILTER(ALL(Table), Table[Week day] <= curDate), Table[Out])
It basically takes the first Custom.Free space value and adds the sum of all [Out] values upto (and including!) the current row.
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hi @sdlx ,
You could refer to the following DAX:
Column =
CALCULATE (
SUM ( 'Table'[Out] ),
FILTER ( 'Table', 'Table'[Week day] <= EARLIER ( 'Table'[Week day] ) )
)
+ LOOKUPVALUE (
'Table'[Custom.Free space],
'Table'[Week day], FIRSTDATE ( 'Table'[Week day] )
)
If your "Costom.Free space" is always the same value, you could add this column directly.
Hi,
Thank you for your quick answer, I tried but it doesn't work yet.
I might do someting wrong (I am a beginner right now):
I have copy paste your code in to the Custom column pop up and I just replace the 'Table' by the name of my table wich is 'Model HU leaving' , it give me an error message see print screen:
@v-eachen-msft Can you tell me what I am doing wrong ?
Thank you very much
You can try something like this as a calculated column:
Column =
VAR curDate = Table[Week day]
VAR firstCustomFreeSpace = CALCULATE(SELECTEDVALUE(Table[Custom.Free space]), FILTER(ALL(Table), Table[Week day] = MIN(Table[Week day])))
RETURN
firstCustomFreeSpace + SUMX(FILTER(ALL(Table), Table[Week day] <= curDate), Table[Out])
It basically takes the first Custom.Free space value and adds the sum of all [Out] values upto (and including!) the current row.
Kind regards
Djerro123
-------------------------------
If this answered your question, please mark it as the Solution. This also helps others to find what they are looking for.
Keep those thumbs up coming! 🙂
Proud to be a Super User!
Hello,
Thank you for your answer !
I tried your formula in a custom column. I have replace Table by the nam of my table "Model HU leaving" (Was I suppose to do that ?)
It return a error message see print screen:
@JarroVGIT Can you tell me what I am doing wrong ?
Thank you very much for your time !
Proud to be a Super User!
Hi,
Thank you I learn something !
S I tried with the calculated column and here is the error message I get for your solution @v-eachen-msft :
And for your solution @JarroVGIT :
Do you see what could be the mistake ?
Thank you so much for your help !
Proud to be a Super User!
Hi @JarroVGIT ,
I corrected my mistake, I feel that we are close to have a solution but I still have one error message about the SUMX that cannot work with value of type string:
Thank you so muche for your time !
Proud to be a Super User!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
96 | |
77 | |
66 | |
53 |
User | Count |
---|---|
144 | |
105 | |
102 | |
89 | |
63 |