Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KatkaS
Post Patron
Post Patron

Split of the amount based on a key

Dears

 

I have a simple table as below and I would need to calculate (create new calculated column?)

when Amount for Cost centers A, B, C remain as is, but Amount for cost center D (Service Common) is split between Cost centers A, B, C by 1/3.

 

Could you please help?

Thank you very much!

 

PeriodCost centerServiceAmountNew amount
MarchAPurchasingxx xx + 1/3 of CC D
MarchBAccountingxxxx + 1/3 of CC D
MarchCControllingxxxx + 1/3 of CC D
MarchDCommonxx-
2 REPLIES 2
v-luwang-msft
Community Support
Community Support

HI @KatkaS ,

You could try the following dax to create a new column:

amount2 = 
var test3=CALCULATE(VALUES('Table'[Amount])/3,FILTER(ALL('Table'),'Table'[Cost center]="D"))  
var TEST2= IF('Table'[Cost center]="A"||'Table'[Cost center]="B"||'Table'[Cost center]="C",'Table'[Amount]+test3,'Table'[Amount])  
RETURN TEST2

And final :

v-luwang-msft_0-1619749384050.png

Wish it is helfpul for you!

 

Best Regards

Lucien

amitchandak
Super User
Super User

@KatkaS , Try a column like

new column =
var _1 = sumx(filter(Table, Table[Cost] = "D" && [Period] =earlier([Period]) && [Service] = "Common"),[Amount])
return
if(Table[Cost] in {A,B,C}, _1/3, Blank())

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.