Forum Discussion
Anonymous
6 years agoNot applicable
Need help created a new column with formula
I have a table called Team Members with columns called prop_id, Allocation, and Role. Unfortunately, Allocation is not always correct in the data source for some situations and it can't be fixed easi...
- 6 years ago
Hi Anonymous ,
We can create a calculated column as below.
Column = VAR a = CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[Role] = "Lead" && 'Table'[prop_id] = EARLIER ( 'Table'[prop_id] ) && 'Table'[Member ID] <= EARLIER ( 'Table'[Member ID] ) ) ) VAR b = CALCULATE ( SUM ( 'Table'[Allocation] ), FILTER ( 'Table', 'Table'[Role] = "Lead" && 'Table'[prop_id] = EARLIER ( 'Table'[prop_id] ) && 'Table'[Member ID] <= EARLIER ( 'Table'[Member ID] ) ) ) RETURN IF ( NOT ( ISBLANK ( a ) ) && b = 0, 100, 'Table'[Allocation] )
v-frfei-msft
Community Support
6 years agoHi Anonymous ,
We can create a calculated column as below.
Column =
VAR a =
CALCULATE (
COUNTROWS ( 'Table' ),
FILTER (
'Table',
'Table'[Role] = "Lead"
&& 'Table'[prop_id] = EARLIER ( 'Table'[prop_id] )
&& 'Table'[Member ID] <= EARLIER ( 'Table'[Member ID] )
)
)
VAR b =
CALCULATE (
SUM ( 'Table'[Allocation] ),
FILTER (
'Table',
'Table'[Role] = "Lead"
&& 'Table'[prop_id] = EARLIER ( 'Table'[prop_id] )
&& 'Table'[Member ID] <= EARLIER ( 'Table'[Member ID] )
)
)
RETURN
IF ( NOT ( ISBLANK ( a ) ) && b = 0, 100, 'Table'[Allocation] )
Anonymous
6 years agoNot applicable
This totally worked. I was trying to do it with M in Power Query, but just creating a custom column with a DAX formula was easy with your instructions.
- Nathaniel_C6 years ago
Community Champion
Anonymous ,
One thing to be aware of is that there is significantly higher overhead using a Calculated Column as opposed to doing this in Power Query.