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
awff
Helper III
Helper III

Averages not calculating correctly when grouped

Hi All, Happy Friday from Australia!

 

After wasting hours trying to figure this out, i'm reaching out for help!


I'm trying to work out the average days taken to invoice each quote on a group by quote level. Currently the -21.8 average for "Days Taken" is correct on a row by row basis in the below table:

 

AccountQuote NameStart DateEnd DateInvoice DateDays TakenProductTotal Price
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14A$460
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14C$760
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14B$1,899
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14C$3,039
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14C$1,140
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14C$25,369
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14D$3,039
Customer Pty ltdQuote B31-Aug-2030-Jun-2128-Oct-2058A$2,455
Customer Pty ltdQuote B30-Oct-2030-Jun-2128-Oct-20-2A$2,292
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41A$565
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41A$940
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41B$2,351
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41C$3,760
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41D$1,412
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41D$31,387
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41C$3,760
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41E$13,225
    PBI average result-21.8 Total: $97,851

 

However... i want to be able to group these by:
* Quote;
* Start Date;
* Remove Product, and only show Sum of all Total Price

 

...so there should be only four rows distiguised by the font colour and should look like this Quote B has different days and shows as two rows.

AccountQuote NameStart DateEnd DateInvoice DateDays TakenTotal Price
Customer Pty ltdQuote A30-Jun-2030-Jun-2116-Jun-20-14$35,704
Customer Pty ltdQuote B31-Aug-2030-Jun-2128-Oct-2058$2,455
Customer Pty ltdQuote B30-Oct-2030-Jun-2128-Oct-20-2$2,292
Customer Pty ltdQuote C30-Jun-2130-Jun-2220-May-21-41$57,400
    PBI average result-21.8Total: $97,851

 

THE ISSUE: The average is incorrect and is still calculating on a row by row basis. The desired result would be 0.25.

 

Any help would be greatly appreciated!

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

Hi @awff ,

 

Please try the following formula:

 

Measure = 
AVERAGEX (
    SUMMARIZE (
        'Table',
        'Table'[Quote Name],
        'Table'[Start Date],
        "Average of Days", AVERAGE ( 'Table'[Days Taken] )
    ),
    [Average of Days]
)

vkkfmsft_0-1643869008545.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
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-kkf-msft
Community Support
Community Support

Hi @awff ,

 

Please try the following formula:

 

Measure = 
AVERAGEX (
    SUMMARIZE (
        'Table',
        'Table'[Quote Name],
        'Table'[Start Date],
        "Average of Days", AVERAGE ( 'Table'[Days Taken] )
    ),
    [Average of Days]
)

vkkfmsft_0-1643869008545.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
Best Regards,
Winniz
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

VahidDM
Super User
Super User

Hi @awff 

 

Read this post, you can find your solution:
https://www.vahiddm.com/post/why-my-measure-returns-the-wrong-total

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

 

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.