Forum Discussion
fab196
4 years agoHelper II
Sum OF values
Hi Everyone , need your help i want use power query and generate the result below I have with two columns first is original col and second one is derived column as mentioned the below i wan...
- 4 years ago
fab196 , a new column
new column =
vat _b = [B]+0
return
countx(filter(Table, [A] = earlier([A]) && [B]+0 <= +b ), [A])
- 4 years ago
Hi fab196 ,
According to your description, it's more easier to achieve it by DAX, here's my solution.
1.In Power Query, add an index column.
Get this table.
2.Create a calculated column.
Count = VAR _RANK = RANKX ( FILTER ( ALL ( 'Table' ), 'Table'[ColumnA] = EARLIER ( 'Table'[ColumnA] ) && 'Table'[ColumnB] = EARLIER ( 'Table'[ColumnB] ) && 'Table'[ColumnA] = 'Table'[ColumnB] ), 'Table'[Index], , ASC, DENSE ) RETURN IF ( 'Table'[ColumnA] = 'Table'[ColumnB], _RANK + 1, _RANK )Get the expected result.
I attach my sample below for reference.
Best Regards,
Community Support Team _ kalyjIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
amitchandak
4 years agoSuper User
fab196 , refer if this can help
fab196
4 years agoHelper II
| col a | PREVIOUS ROW | ||
| A | NULL | HERE IS NULL SO DEFAULT VALUE IS 1 | 1 |
| A | A | A=A SO ADDITION LIKE ABOVE 1 VALUE PLUS ADD 1 | 2 |
| A | A | A=A SO ADDITION LIKE ABOVE 1 VALUE PLUS ADD 2 | 3 |
| B | A | B<>A SO | 1 |
| C | B | C<>B | 1 |
I WANT TO RESULT LIKE THIS