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

Measure to Calculate Group Sums in PivotTable

Hi,

 

I am using my data model with both Power BI and PowerPivot, thus why I am posting here.  

 

Here is an example of my data structure.  I have the first 3 columns in my data table.  I am trying to write a measure that will allow me to generate the 4th column, which is the sum of "Value1" within each date group.  This seems like it should be simple, but everything I try returns the original "Value1" for each row instead of the group aggregate.  Thanks for your help.

 

DateObsValue 1SumDatexValue
1/1/20191200750
1/1/20192300750
1/1/20193250750
1/2/201916002000
1/2/201925002000
1/2/201939002000
1 ACCEPTED SOLUTION
AlB
Super User
Super User

Hi @mrlang02 

It sounds like you need a calculated column rather than a measure. Try this:

SumDatexValue =
CALCULATE ( SUM ( Table1[Value1] ), ALLEXCEPT ( Table1, Table1[Date] ) )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

Hi @mrlang02 

It sounds like you need a calculated column rather than a measure. Try this:

SumDatexValue =
CALCULATE ( SUM ( Table1[Value1] ), ALLEXCEPT ( Table1, Table1[Date] ) )

 

Please mark the question solved when done and consider giving kudos if posts are helpful.

Cheers  Datanaut

mrlang02
Frequent Visitor

Thank you so much this works perfectly.  Appears I can use this as either a calculated column or measure and it achieves what I need.

In general, I've read that using measures whenever you can will improve calculation times, thus why I was taking that approach.  But very helpful to know I can do it either way.  

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