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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Take the latest value in a subcategory and roll it up to category

Hi Team
I have a table which has
Month Cat SubCat. value
Aug. A. B. 10
Aug. A. B. 12. —— latest
Aug. A. C. 13. —— latest
Sep. A. B. 15 —— latest
sep. E. D. 30. - latest

In this at subcat level I want to take the latest value at Month level. For this I created a index col and a simple measure Works at subcat level calculate(sum(value),index = a) # a = max(index)
But the same measure doesn’t work at Cat level as it will take the max of index at cat leve but what I need is at cat level it will sum the underlying sub cats latest values.
So for Aug for Cat A it should he 12+13 = 25 but the current measure gives 13. Sep for A is 15 etc.
Help needed!
1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this measure:

 

Measure = SUMX(SUMMARIZE('Table'; 'Table'[Month]; 'Table'[Cat]; 'Table'[SubCat]; "Max"; MAX('Table'[value])); [Max])
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

2 REPLIES 2
Anonymous
Not applicable

This is the correct code:

// Assumption:
// [Index] column establishes the temporal order
// among the entries.
// T is your table.

[Your Measure] =
var __indexesOfInterest	=
	SELECTCOLUMNS(
		ADDCOLUMNS(
			SUMMARIZE(
				T,
				T[Month],
				T[Cat],
				T[SubCat]
			),
			"@index",
				CALCULATE( MAX( T[Index] ) )
		),
		"@index", [@index]
	)
var __result =
	CALCULATE(
		SUM( T[Value] ),
		TREATAS(
			__indexesOfInterest,
			T[Index]
		),
		ALL( T )
	)
return
	__result

 

Best

D

camargos88
Community Champion
Community Champion

Hi @Anonymous ,

 

Try this measure:

 

Measure = SUMX(SUMMARIZE('Table'; 'Table'[Month]; 'Table'[Cat]; 'Table'[SubCat]; "Max"; MAX('Table'[value])); [Max])
 
Ricardo


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.