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
naufal_msr
Frequent Visitor

Dividing a sum of group by a unique value depending on group

Hi guys,

 

Im quite new here really appreciate your help.

 

I have a Orders table comprise of Sales, Outlets, and Outlet_Size columns. I'm trying to calculate the rate, which is something like this DIVIDE(SUM(Orders[Sales],Sales[Outlet_Size]). But how do I write a query that can divide a total of all columns, to one single value depending on which outlet ?


Appreciate your help !

 

Thank you

1 ACCEPTED SOLUTION

Hi @naufal_msr ,

Like this?

vyingjl_0-1634103028150.png

 

Best Regards,
Community Support Team _ Yingjie Li
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

5 REPLIES 5
Anonymous
Not applicable

Hello, please can you provide some dummy data to better understand what you are trying to achieve? An example of the calculation you want to perform will help to better understand the outcome you are seeking. Thanks.

Hey thanks for your reply.

 

Suppose my data looks like this :

 

Sale (USD)OutletsOutlets Size (Sqft)
10A500
15A500
10B1500
20C1000
10B1500
30C1000

 

What I'm trying to look for is the totalsales/outletsize (USD/sqft). So it'll work by grouping them into their outlets (A/B/C), sum up the total sales, and divide by their respective outlet size. So for outlet A it'll be 25(USD)/500(sqft) and etc. 

 

Sorry if my explanations and examples are not that well. Appreciate all the help I can get. 

 

Thanks !

Hi @naufal_msr ,

Since you have the same row value in the table, recommend that you can create a calculated column like this:

Result = 
DIVIDE (
    CALCULATE (
        SUM ( 'Table'[Sale (USD)] ),
        ALLEXCEPT ( 'Table', 'Table'[Outlets Size (Sqft)] )
    ),
    CALCULATE (
        MIN ( 'Table'[Outlets Size (Sqft)] ),
        ALLEXCEPT ( 'Table', 'Table'[Outlets Size (Sqft)] )
    )
)

vyingjl_0-1634093238371.png

 

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

Hi Yingjie Li,

 

Thanks this actually helps. But i guess I should mention that I needed this to work with my date range filter. There's also a date column. How do I apply this formula if there are date filter in it ?

 

DateSale (USD)OutletsOutlets Size (Sqft)
1/1/202110A500
1/1/202115A500
2/1/202120A500
2/1/202125A500
1/1/202110B1500
1/1/202115B1500
1/1/202120C1000
2/1/202110B1500
2/1/202130C1000

 

Thank you !

Hi @naufal_msr ,

Like this?

vyingjl_0-1634103028150.png

 

Best Regards,
Community Support Team _ Yingjie Li
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.

Top Solution Authors