cancel
Showing results for
Did you mean:
Regular Visitor

Divide elements of a column by the sum of another column while keeping filters on

Hi all,

I'm new to PoweBI and I'm looking for a way to divide the elements of a column by the total of another column while keeping filters on.

So for example:

 A B date 12 87 9.16 16 32 9.16 56 35 9.17

What I want is the elements of A in date 9.16 divide by the sum of B in date 9.16, so:

 A/B date 12/(87+32) 9.16 16/(87+32) 9.16

I tried doing this in PowerBI

% AB= DIVIDE(SUM(table[A]),SUM(table[B]))

But it would give me

 A/B 12/87 16/32

Which is not desired.

Futhermore I need to keep the date filter in, so I don't think ALL() would be approporiate.

Any kind of help would be highly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team

Re: Divide elements of a column by the sum of another column while keeping filters on

Hi @ningty09 ,

I created a measure to plement it with the function of ALLSELECTED.  The table still can be filtered by date.

Divide = DIVIDE(SUM('Table'[A]),CALCULATE(SUM('Table'[B]),FILTER(ALLSELECTED('Table'),'Table'[date] = MAX('Table'[date]))))

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

3 REPLIES 3
Super User IV

Re: Divide elements of a column by the sum of another column while keeping filters on

https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390

In case it does not help, please provide additional information and mark me with @
My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP,
HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Proud to be a Super User! Linkedin

Regular Visitor

Re: Divide elements of a column by the sum of another column while keeping filters on

Hi, thanks for your reply.  However, I'm trying to use the measure in different visuals and there will be different filter based on each individual visual so I don't think this solution applies.

Community Support Team

Re: Divide elements of a column by the sum of another column while keeping filters on

Hi @ningty09 ,

I created a measure to plement it with the function of ALLSELECTED.  The table still can be filtered by date.

Divide = DIVIDE(SUM('Table'[A]),CALCULATE(SUM('Table'[B]),FILTER(ALLSELECTED('Table'),'Table'[date] = MAX('Table'[date]))))

Best Regards,

Xue Ding

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Announcements

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!