Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

Top Solution Authors