cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Frequent Visitor

## how to create formula for new amount column based on account

Site   Type    Period              Account       Amount
BD1   ANF    2022-09-15     Thujan          4
BD1   ANF    2022-09-16     Thujan          4
BD1   ANF    2022-09-15     Factor           0.3
BD1   ANF    2022-09-16     Factor           0.3
BD1   ANF    2022-09-15     Slippery        1.2
BD1   ANF    2022-09-16     Slippery        1.2

i want to create a new column with sum of values ​​by account,

I've tried this formula but it doesn't work

Amount THujan = CALCULATE([Amount], SS_Account="Thujan")

is there any other way?

2 ACCEPTED SOLUTIONS
Memorable Member

Hi,

you could use the below code for creating the column :

NewAmount = CALCULATE(sum(Sheet56[amount]), all(Sheet56), Sheet56[Account] = EARLIER(Sheet56[Account]))

Appreciate your Kudos and please mark it as a solution if it helps you

Mahyartf
Memorable Member

@PTSS I think you are missing "SUM" here. Hope it Help's

3 REPLIES 3
Super User

try to add a new column with the code below:

AmountSum =
VAR CurrentAccount = TableName[Account]
RETURN
CALCULATE(
SUM(TableName[Amount]),
TableName[Account] = CurrentAccount,
ALL()
)

I tried and it worked like this:

Memorable Member

@PTSS I think you are missing "SUM" here. Hope it Help's

Memorable Member

Hi,

you could use the below code for creating the column :

NewAmount = CALCULATE(sum(Sheet56[amount]), all(Sheet56), Sheet56[Account] = EARLIER(Sheet56[Account]))

Appreciate your Kudos and please mark it as a solution if it helps you

Mahyartf

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - June 2024

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

#### Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors
Top Kudoed Authors