cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Divide a value in a column by a varying number of rows

Hi everyone,

this is my first post here in the pbi forum. I'm happy that i can join the community!

I have the following problem:
I want do divide the values in the 'budget' column by the number of an 'Ad-IDs' occurrence, or in other words, a varying number of rows.
The result should look like in column 'result'. For example, 'Ad-ID' 1 occurs three times. Thus, every value in 'budget' that has the 'Ad-ID' 1 should be divided by three.

Ad-IDBudgetResult
12000666,666667
12000666,666667
12000666,666667
240001000
240001000
240001000
240001000
3100002000
3100002000
3100002000
3100002000
3100002000

 

Is there a possibility to transform the column 'budget', or create a new column in pbi with these results?

 

All the best

Patrick

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: Divide a value in a column by a varying number of rows

@Anonymous 

 

As a calculated column you can add

 

Calc Colum =
DIVIDE (
    [Budget],
    CALCULATE ( COUNTROWS ( TableName ), ALLEXCEPT ( TableName, TableName[Ad-ID] ) )
)

View solution in original post

Anonymous
Not applicable

Re: Divide a value in a column by a varying number of rows

Hey Zubair_Muhammad

That was exactly I was looking for. I tried it with Filter instead of Allexcept and it didn't work out.
Your solution works very well, and i learned a new function.

Many thanks!

All the best,
Patrick

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Divide a value in a column by a varying number of rows

@Anonymous 

 

As a calculated column you can add

 

Calc Colum =
DIVIDE (
    [Budget],
    CALCULATE ( COUNTROWS ( TableName ), ALLEXCEPT ( TableName, TableName[Ad-ID] ) )
)

View solution in original post

Anonymous
Not applicable

Re: Divide a value in a column by a varying number of rows

Hey Zubair_Muhammad

That was exactly I was looking for. I tried it with Filter instead of Allexcept and it didn't work out.
Your solution works very well, and i learned a new function.

Many thanks!

All the best,
Patrick

View solution in original post

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Users Online
Currently online: 399 members 3,769 guests
Please welcome our newest community members: