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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Euro0681
Helper II
Helper II

Dividing 2 columns

I am trying to simply divide 2 columns but when doing so i get a wrong value (Example Below)

Euro0681_0-1669650552139.png

The correct value I'm looking for is "1.xxxx" , Note Column1 is displaying the sum and same concept for Column2 (they are displaying the sum for the entire column)


 

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Euro0681 

create a Measure 

DIVIDE ( SUM ( 'Table'[Column1] ), SUM ( 'Table'[Column2] ) )

View solution in original post

6 REPLIES 6
Euro0681
Helper II
Helper II

@tamerj1 We can think of Column1 = quantity and column2 = price or something like that so each category has different quantity and price but the division for each is what i want to be static

 

@Euro0681 

Please try

=
SUMX ( 'Table', DIVIDE ( 'Table'[Column1], 'Table'[Column2] ) )

tamerj1
Super User
Super User

Hi @Euro0681 

create a Measure 

DIVIDE ( SUM ( 'Table'[Column1] ), SUM ( 'Table'[Column2] ) )

@tamerj1 what if i need the value to be static and not change whenever extra fields are added, in other words is there a way to do this using a column as opposed to a measure?

@Euro0681 

CALCULATE ( DIVIDE ( SUM ( 'Table'[Column1] ), SUM ( 'Table'[Column2] ) ), ALL ( 'Table' ) )

for more clarification I want the value to be static for every category. Example
Catogry1 Total = Column1/Column2 = 2.02 (made up numbers)
Category2 Total = Column1/Column2 = 1.02 (made up numbers)
 anytime i use Category1 with any other fields it should always remain '2.02' kind of like a group by in SQL?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors