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
ajmonster
Helper II
Helper II

Sum values by line excluding past entries for same ID

Hello

 

I need help running calculations on a live survey feed.

 

I have a table that will continuously add records to itself. I need to sum values but I can't sum in previous records for the same ID. For example, suppose I have the following table:

NameCompletedValue
Jon2/26/20182
Jacob2/25/20183
Jon2/24/20181
Jill2/26/20185
Jim2/26/20184
Jacob2/23/20184

 

For sums, I only want to sum the values for each name given the latest date for that name. The sum I want returned is:

Jon = 2
Jacob = 3
Jill = 5

Jim = 4

Total = 14

Average = 3.5 

 

Thanks,

ajmonster

 

PS Bonus points if you can somehow create a table comprised of the unique Names and have their records update when the master query has a more recent record.

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@ajmonster

 

The Bonus points :

 

Go to Modeling- New Table

 

Table =
SUMMARIZECOLUMNS (
    Table1[Name];
    "Lastrecord"; MAX ( Table1[Completed] );
    "Value"; CALCULATE (
        SUM ( Table1[Value] );
        FILTER ( Table1; Table1[Completed] = MAX ( Table1[Completed] ) )
    )
)

Regards

 

Victor

Lima - Peru




Lima - Peru

View solution in original post

4 REPLIES 4
Vvelarde
Community Champion
Community Champion

@ajmonster

 

The Bonus points :

 

Go to Modeling- New Table

 

Table =
SUMMARIZECOLUMNS (
    Table1[Name];
    "Lastrecord"; MAX ( Table1[Completed] );
    "Value"; CALCULATE (
        SUM ( Table1[Value] );
        FILTER ( Table1; Table1[Completed] = MAX ( Table1[Completed] ) )
    )
)

Regards

 

Victor

Lima - Peru




Lima - Peru

@Vvelarde

 

Is there a way to merge all the columns from Table1 (in my exact case, I have 40 columns) into this created Table?

@ajmonster

 

Hi, i'm not sure that can be possible without reference all the columns that you want to summarize.

 

 




Lima - Peru

@Vvelarde This is it. Thank you.

 

Would I be able to use SELECTEDVALUE ( Table1[Value] ) instead of SUM( Table1 [Value] ) to select the field Value in the case that there are two records under the same [Name] and same [Completed] date?

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.