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

Divide sum of one column by sum of another column then filter by month

Hi, absolute beginner here. With reference to the data below, I want to create a bar chart which displays the values of total weight/ total hours by month. Month is filtered by end date. So for instance total weight/ total hours for June is (100 + 75) / (0.75 + 1) = 100,

and (150+40 +200) / (1.5 +1+4) = 60.

 

Any help is much appreciated!

 

Start DateEnd DateHoursWeight
1/6/2019 0:151/6/2019 1:000.75100
4/6/2019 8:004/6/2019 9:00175
30/6/2019 23:301/7/2019 1:001.5150
1/7/2019 6:001/7/2019 7:00140
6/7/2019 0:156/7/2019 4:154200

 

meta-chart.png

 

 

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

Hi @Anonymous 

 

Please add the calculated column [MonthofEnddate] then use the measure:

ME = MONTH(Table1[End Date])

Measure = var a = CALCULATE(SUM(Table1[Weight]),ALL(Table1),VALUES(Table1[ME]))
var b = CALCULATE(SUM(Table1[Hours]),ALL(Table1),VALUES(Table1[ME]))
Return
DIVIDE(a,b)

6.png

Best regards,

Dina Ye

Community Support Team _ Dina Ye
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

2 REPLIES 2
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Please add the calculated column [MonthofEnddate] then use the measure:

ME = MONTH(Table1[End Date])

Measure = var a = CALCULATE(SUM(Table1[Weight]),ALL(Table1),VALUES(Table1[ME]))
var b = CALCULATE(SUM(Table1[Hours]),ALL(Table1),VALUES(Table1[ME]))
Return
DIVIDE(a,b)

6.png

Best regards,

Dina Ye

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

Hi @Anonymous ,

 

If my above post helps, could you please consider Accept it as the solution to help the other members find it more quickly. thanks!

Best regards,
Dina Ye

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

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.