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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
NirmalRayan
Regular Visitor

Sum of Values of minimum date for each group measure

NirmalRayan_0-1593071349378.png

 

I found this question in Stack Overflow but it was for SQL query. I would like to know how this can be done in DAX. 

It should be a measure as it should dynamically (should work on filtered data too)  select the minimum date for each group (ID)  and sum the values (WEIGHT) corresponding to it. 

 

Thanks for the Help. 🙂

1 REPLY 1
Mariusz
Community Champion
Community Champion

Hi @NirmalRayan 

 

Try the below.

Measure = 
SUMX(
    SUMMARIZE( 'Table', 'Table'[ID], 'Table'[DATE] ),
    VAR __minDate = 
        CALCULATE(
            MIN( 'Table'[DATE] ), 
            ALL( 'Table'[DATE] )  
        ) 
    RETURN 
        IF( 
            __minDate = 'Table'[DATE],
            CALCULATE( 
                SUM( 'Table'[weight] ),
                'Table'[DATE] = __minDate 
            )
        )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.