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
bcap01
Helper II
Helper II

DAX Calculation Not Working

I would like to combine the value of (2) fields to determine percetage of Billable hours.

 

For example, what I would like to do is this:  ChargeableHours/(ChargeableHours+NonChargableHours) or 158/(158+322) = 32.91%.

 

Here is my DAX:

P% = (table[ChargeHours])/(table[TotalHours])
 
For some reason I am getting a different percentage than expected.  What adjustment do I need to make this work?

 

 

5 REPLIES 5
bcap01
Helper II
Helper II

Thanks again @FreemanZ ,

 

For some reason the Matrix is still accuminating instead of doing the calculation.  Perhaps do I need to do CALCULATE somewhere?

 

BI_Util2.png

hi @bcap01 

could you share some raw dataset?

bcap01
Helper II
Helper II

@FreemanZ 

 

Many thanks for your reply!  Below is what my data looks like.  What seems to be happening is the UTil% column is accuminating/adding instead of doing the desired calculation of ChargeHours/TotalHours.

 

TotalHours is a column I made which is:  ChargeHours + NonCHargeHours. 

ChargeHours and NonChargeHours are fields from the database table I am importing.

 

BI_Util.png

Many help is greatly appreciated!

hi @bcap01 

try like:

Util% =
DIVIDE(
    SUM(TableName[ChargeHours]),
    SUM(TableName[TotalHours])
)

 

FreemanZ
Super User
Super User

hi @bcap01 

 

is P% a calculated column or measure? please consider provide some sample data to well reflect your case. 

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