Reputation: 471
I am just getting started with Power Bi and now I require some help.
I need a formula that creates a new column (called "Combined" in below example picture) that uses the following logic:
On the left side you see my current result and the desired output on the right.
I hope you can help me out.
Update:
To make the example a bit clearer, I combined both ParentIDs:
Thank you.
Upvotes: 3
Views: 8011
Reputation: 1781
Create two calculated columns using the following measures:
Sum Of Current = CALCULATE(SUM('Table'[Current])
, FILTER('Table', 'Table'[ParentID] = EARLIER('Table'[ParentID])))
Combined = IF('Table'[Sum Of Current] > 0, 'Table'[Current], 'Table'[Budget])
If you are unfamiliar with creating calculated columns just right click on any column in your table and select the 'New Column' option:
If you don't need both columns just use this:
Combined = IF(CALCULATE(SUM('Table'[Current])
, FILTER('Table', 'Table'[ParentID] = EARLIER('Table'[ParentID])))
> 0, 'Table'[Current], 'Table'[Budget])
Upvotes: 2