cancel
Showing results for
Did you mean:

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a \$100 discount. Register Now

Frequent Visitor

Sum the Max within a grouped value

Hi there,

I'd like to calculate the following in a measure (see screenshot):

1 ACCEPTED SOLUTION
Community Support

Hi @topigs_user ,

Check the measures as below.

``````Measure =
var max_date = CALCULATE(MAX('Table'[date]),ALLEXCEPT('Table','Table'[plantid]))
return
IF(SELECTEDVALUE('Table'[date])=max_date,SUM('Table'[value]),BLANK())

Measure 2 = SUMX('Table',[Measure])``````

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
3 REPLIES 3
Community Support

Hi @topigs_user ,

Check the measures as below.

``````Measure =
var max_date = CALCULATE(MAX('Table'[date]),ALLEXCEPT('Table','Table'[plantid]))
return
IF(SELECTEDVALUE('Table'[date])=max_date,SUM('Table'[value]),BLANK())

Measure 2 = SUMX('Table',[Measure])``````

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
Employee

Here is a measure expression that should work.

RecentValue =
VAR vLastValue =
SUMX (
VALUES ( T1[PlantID] ),
CALCULATE (
LASTNONBLANKVALUE (
T1[Date],
AVERAGE ( T1[Value] )
)
)
)
RETURN
IF (
OR (
NOT (
HASONEVALUE ( T1[PlantID] )
),
MAX ( T1[Date] )
CALCULATE (
MAX ( T1[Date] ),
ALLSELECTED ( T1[Date] )
)
),
vLastValue
)

Pat

Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

Frequent Visitor

Hi there, thanks for your support.

Unfortunately, it does not the trick.

It shows me 15 on all rows where plantid is 456. I only want to see it on the row where the modification date = max date.

Announcements

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Power BI Monthly Update - February 2024

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

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Top Solution Authors
Top Kudoed Authors