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
Anonymous
Not applicable

DAX to divide table totals from 2 columns

Hi,

 

In the below table (direct hours (A), and Earned (B)) are delivering the right SUM total.

However, the (performance (C)) column needs to be 153.88 divided by 142.7 .

Basically, I need a table that Sums column A, Sums column B, but column C has to divide the totals of B & A (B:A).

 

Moreover, the table is being filtered by users, using filters for (Assoc_ID, and WK_end_date).

 

I tried this, but it doesn't work:

CALCULATE(DIVIDE(SUM(tblTempReport[earned]),(SUM(tblTempReport[direct_hours])))

 

Alexrk_0-1604679707286.png

 

1 ACCEPTED SOLUTION
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this.

Measure = 
VAR x = 
MAX([Earned])/ MAX([Direct hours])
RETURN
IF(
    HASONEFILTER(Sheet1[Direct hours]),
    x,
    DIVIDE( SUM(Sheet1[Earned]), SUM(Sheet1[Direct hours]) )
)

v-lionel-msft_0-1604888725862.png

 

Best regards,
Lionel Chen

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

View solution in original post

3 REPLIES 3
v-lionel-msft
Community Support
Community Support

Hi @Anonymous ,

 

Try this.

Measure = 
VAR x = 
MAX([Earned])/ MAX([Direct hours])
RETURN
IF(
    HASONEFILTER(Sheet1[Direct hours]),
    x,
    DIVIDE( SUM(Sheet1[Earned]), SUM(Sheet1[Direct hours]) )
)

v-lionel-msft_0-1604888725862.png

 

Best regards,
Lionel Chen

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

amitchandak
Super User
Super User

@Anonymous , This formula seems fine. What is the issue you are getting

CALCULATE(DIVIDE(SUM(tblTempReport[earned]),(SUM(tblTempReport[direct_hours])))

 

Can you share sample data and sample output in table format?

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

Anonymous
Not applicable

Thanks,

 

Yes, it seems that the above formula is OK, but the above result for C should be 107.83, not 14.78.

Here is a more clear example:

Alexrk_1-1604684694542.png

 

 

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.