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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Divide a measure by a measure

Hello, 

 

I don't know if this is the best way to go about this. I'm sure I could get this all done in the orginal formula, but I will explain what I have. Below I have two formulas that I need to divide formula 1 by formula 2. I'm gettting an infinte number when trying to do a simple =Divide(Measure1,Measure2).

 

Can anyone help me with this?

 

1.  CALCULATE(SUM(Hotel[Period 1 Hotel Booked Amount]),Hotel[Preferred Vendor Status]="Preferred")
2.  CALCULATE(SUM(Hotel[Period 1 Hotel Room Nights]),Hotel[Preferred Vendor Status]="Preffered")
 
Thank you!
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , this should work

 

measure 1= CALCULATE(SUM(Hotel[Period 1 Hotel Booked Amount]),Hotel[Preferred Vendor Status]="Preferred")
measure 2 CALCULATE(SUM(Hotel[Period 1 Hotel Room Nights]),Hotel[Preferred Vendor Status]="Preffered")

 

Measure 3 = divide([measure1],[measure2])

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , this should work

 

measure 1= CALCULATE(SUM(Hotel[Period 1 Hotel Booked Amount]),Hotel[Preferred Vendor Status]="Preferred")
measure 2 CALCULATE(SUM(Hotel[Period 1 Hotel Room Nights]),Hotel[Preferred Vendor Status]="Preffered")

 

Measure 3 = divide([measure1],[measure2])

Anonymous
Not applicable

Hello,

 

It works.... I'm a fool. Spelled Preferred wong in my second formula.

 

Thanks for your help!

 

You can also add a third argument to divide() for what to return if you have division by 0.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.