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
FredrikR_SO
New Member

Problem with sum of measure

I have the following table (simplified)

  • Customer Name
  • Billable hours
  • Non billable hours
  • Billable amount
  • Average billable rate (measure SUM(Billable amount)/SUM(Billable hours))
  • Estimated non billable amount (measure SUM(Non billable hours)*Average billable rate

I present this in a table and add a visual filter to hide rows where "Non billable hours" is 0
The table sums it up nice where the total of "Estimated non billable amount" is correct

I then add a Card only showing the total "Estimated non billable amount" it then shows another amount. It is not allowed to filter this visual the same way as the table

 

Since not all customers have Non billable hours the measure calculates different average billable rates in the table and in the Card. How can I fix this?

 

Thanks!

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

Hi @FredrikR_SO ,

 

I created sample data based on your description.

vstephenmsft_0-1640760540932.png

Visual filter

visual filter = IF(MAX('Table'[Non billable hours])<>0,1)

vstephenmsft_1-1640760631356.png

Average billable rate = SUM('Table'[Billable amount])/SUM('Table'[Billable hours])
Estimated non billable amount = SUM('Table'[Non billable hours])*[Average billable rate]

vstephenmsft_2-1640760697256.png

It should be 33.95 instead of 33.62.

 

You can get the correct result by creating a new measure.

Total = SUMX('Table',[Estimated non billable amount])

vstephenmsft_3-1640760786941.png

You can check more details from the attachment.

 

Best Regards,

Stephen Tao

 

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-stephen-msft
Community Support
Community Support

Hi @FredrikR_SO ,

 

I created sample data based on your description.

vstephenmsft_0-1640760540932.png

Visual filter

visual filter = IF(MAX('Table'[Non billable hours])<>0,1)

vstephenmsft_1-1640760631356.png

Average billable rate = SUM('Table'[Billable amount])/SUM('Table'[Billable hours])
Estimated non billable amount = SUM('Table'[Non billable hours])*[Average billable rate]

vstephenmsft_2-1640760697256.png

It should be 33.95 instead of 33.62.

 

You can get the correct result by creating a new measure.

Total = SUMX('Table',[Estimated non billable amount])

vstephenmsft_3-1640760786941.png

You can check more details from the attachment.

 

Best Regards,

Stephen Tao

 

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

Anonymous
Not applicable

just a quick thought whilst I'm on my phone but could you try something like this:

Estimated non billable amount = calculate(SUM(Non billable hours)*Average billable rate, filter(table,table[Non billable hours]>0))

 

 

Thanks, I actually tried that but for some reason Estimated non billable amount = NaN in that 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.