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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Divide measures, total line ignore 0s in one

I have two measures in a table containing numbers.

Measures A and B.

 

A

B

5

2

8

5

10

0

0

5

 

I want to divide B with A and get percentages, like so:

 

A

B

Measure

5

2

40 %

8

5

63 %

10

0

 

0

5

0 %

 

But for the total line, I want the sum of B divided by sum of A, ONLY if column A has a number, like so:

 

 

A

B

Measure

 

5

2

40 %

 

8

5

63 %

 

10

0

 

 

0

5

0 %

Total

23

12

30 %

 

The number 5 in the last B cell is not included in the total.
The calculation becomes (12-5) / 23 = 30 %

 

 

 

1 ACCEPTED SOLUTION

Hello @Preben

Measure = SUMX(FILTER(Sheet1,Sheet1[A]<>BLANK()|| Sheet1[A]<>0),Sheet1[B])/SUMX(Sheet1,Sheet1[A])

Best regards

Maggie

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

Measure = CALCULATE(SUM(Sheet1[B]),FILTER(Sheet1,Sheet1[A]<>BLANK()||Sheet1[A]<>0))/SUM(Sheet1[A])

Capture7.JPG

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thanks, but SUM does not work on measures. Any other suggestions?

Hello @Preben

Measure = SUMX(FILTER(Sheet1,Sheet1[A]<>BLANK()|| Sheet1[A]<>0),Sheet1[B])/SUMX(Sheet1,Sheet1[A])

Best regards

Maggie

amitchandak
Super User
Super User

@Anonymous , Use divide function

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

No. A simple divide gives the example I gave in the thread:

A

B

Measure

5

2

40 %

8

5

63 %

10

0

 

0

5

0 %

 

= 52 %

 

It should ignore the last B column because the A column has a 0. 

This rule should only work on A, and not B. 

 

The correct answer should give 30 %

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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