Forum Discussion
roelf
3 years agoHelper II
Selective sum based on row type
***Sorry for the sloppy table format - seems like the forum changes it when I post... Hi I need to be able to sum values in a column, based on a TYPE attribute in the same row. However, I nee...
- 3 years ago
Hi roelf ,
try this
Column = IF('Tabelle23'[Type] ="stack", SUMX( FILTER( 'Tabelle23', 'Tabelle23'[DateTime] <= EARLIER(Tabelle23[DateTime]) && 'Tabelle23'[Type] = "pick" ), 'Tabelle23'[PickWeight] ) )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous3 years ago
Hi roelf ,
I have created a simple sample, please refer to it to see if it helps you.
Create 2 columns first.
stack = IF('Table'[Type]="stack",0,1)minflagdate = calculate(MIN('Table'[DateTime]),FILTER(ALLSELECTED('Table'),'Table'[DateTime]>=EARLIER('Table'[DateTime])&&'Table'[stack]=0))Then create a measure.
Measure = var _1= CALCULATE(SUM('Table'[PickWeight]),FILTER(ALL('Table'),'Table'[minflagdate]=SELECTEDVALUE('Table'[minflagdate])&&'Table'[Type]="pick")) return IF(MAX('Table'[Type])="stack",_1,BLANK())Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
roelf
3 years agoHelper II
Thanks for the reply mangaus1111 .
That partially answers my scenario, but as you can see the "Stack Weights" cumulate, example the second stack weight is 9.85, where it should have been 4.308. So I'm wondering if there is a way to substract a stackweight from a previous one ?