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
DauletKali
Helper I
Helper I

Summarize columns under specific terms

Hi there! I need your help in solving a problem 

I need to show unit cost by seperate month and by accumulating several month. It is ok when I choose only one month, but when I want to accumulate data for several months it just summarize unit cost. For example, if unit cost for first month is 2 unit and for the second month is 3 unit, when I combine those month together (1+2) instead of showing 2,5 it shows the sum of theese two figures - 5.  What dax formula should I use to make it correct? Thanks 

 

This is my function which is, I guess, is not suit this case.

DauletKali_0-1599822317671.png

 

Here is the unit costs for 6th month seperately

DauletKali_3-1599823098876.png

Here is the unit costs for 7th month seperately

DauletKali_4-1599823165804.png

 Here is the unit costs for two month combined which shows the sum of unit cost for two months. 

DauletKali_2-1599823064551.png

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

It looks like you are using summarized data, with only one entry per month, which is why it works fine for one month. You should have two options, and they will give slightly different results, so depends what you want.

Option A) What you have described is to use the column you already have, but apply AVERAGE summarization in the visual. https://docs.microsoft.com/en-us/power-bi/create-reports/service-aggregates#change-how-a-numeric-fie...

Option B) Create a new MEASURE instead of column, using the same idea for formula:
Avg Unit Price = DIVIDE(SUM(SalesAmount), SUM(QtySold))

As a side note, you may also wish to use a DimDate table for this: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @DauletKali,

It sounds like you want to change measure total level calculation. I'd like to suggest you take a look at the following blogs to know how to check the current row contents level and replace them with specific expressions.

Clever Hierarchy Handling in DAX 

Measure Totals, The Final Word 

Regards,

Xaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
AllisonKennedy
Super User
Super User

It looks like you are using summarized data, with only one entry per month, which is why it works fine for one month. You should have two options, and they will give slightly different results, so depends what you want.

Option A) What you have described is to use the column you already have, but apply AVERAGE summarization in the visual. https://docs.microsoft.com/en-us/power-bi/create-reports/service-aggregates#change-how-a-numeric-fie...

Option B) Create a new MEASURE instead of column, using the same idea for formula:
Avg Unit Price = DIVIDE(SUM(SalesAmount), SUM(QtySold))

As a side note, you may also wish to use a DimDate table for this: https://excelwithallison.blogspot.com/2020/04/dimdate-what-why-and-how.html

Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

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