Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hello, Guys!
Two little questions for you:
1. How can I calculate on Power Bi a new column that count previous occurrences, based on ID number, of a name from another column?
Example:
2. Also, how can I create a column (D) that brings a specific attribute (Position now) from only the last occurrence of a name?
Example:
Thanks a lot!
Solved! Go to Solution.
Try this
Previous Occurrences = CALCULATE ( COUNTROWS ( TableName ), FILTER ( ALLEXCEPT ( TableName, TableName[Name] ), TableName[ID] <= EARLIER ( TableName[ID] ) ) ) - 1
And this
Last Position = VAR previousID = CALCULATE ( MAX ( TableName[ID] ), FILTER ( ALLEXCEPT ( TableName, TableName[Name] ), TableName[ID] < EARLIER ( TableName[ID] ) ) ) RETURN CALCULATE ( SUM ( TableName[Position Now] ), FILTER ( ALLEXCEPT ( TableName, TableName[Name] ), TableName[ID] = previousID ) )
Try this
Previous Occurrences = CALCULATE ( COUNTROWS ( TableName ), FILTER ( ALLEXCEPT ( TableName, TableName[Name] ), TableName[ID] <= EARLIER ( TableName[ID] ) ) ) - 1
And this
Last Position = VAR previousID = CALCULATE ( MAX ( TableName[ID] ), FILTER ( ALLEXCEPT ( TableName, TableName[Name] ), TableName[ID] < EARLIER ( TableName[ID] ) ) ) RETURN CALCULATE ( SUM ( TableName[Position Now] ), FILTER ( ALLEXCEPT ( TableName, TableName[Name] ), TableName[ID] = previousID ) )
It worked beautifully! Many many thanks!
User | Count |
---|---|
64 | |
55 | |
46 | |
31 | |
31 |
User | Count |
---|---|
84 | |
74 | |
49 | |
48 | |
41 |