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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.