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

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

Reply
cgaralde
Frequent Visitor

Measure to calculate based on current row

HI,

 

I am trying to create a measure to show the total quantity based on Location and Type. 

LocationTypeQuantity
Loc1010
Loc212
Loc114
Loc123
Loc214
Loc105

I have the following formula:

 

Rcvd =
CALCULATE(
SUM([Quantity]),
'Item'[Type] = "0",
'Item'[Location] = EARLIER('Item'[Location])
)
 
but EARLIER does not seem to work on this context.  Filtering on Type is fine as it is a static value, but how do I filter on the same location as the current row.  Any help is appreciated. 🙂
 
1 ACCEPTED SOLUTION
Jos_Woolley
Solution Sage
Solution Sage

Hi,

But this is a measure, correct, not a calculated column? So you can simply use:

 

Rcvd =
CALCULATE ( SUM ( [Quantity] ), 'Item'[Type] = 0 )

 

which, when placed in e.g. a table visual with along with Location will produce:

 

LocationRcvd
Loc115
Loc2 

 

Regards

View solution in original post

2 REPLIES 2
Jos_Woolley
Solution Sage
Solution Sage

Hi,

But this is a measure, correct, not a calculated column? So you can simply use:

 

Rcvd =
CALCULATE ( SUM ( [Quantity] ), 'Item'[Type] = 0 )

 

which, when placed in e.g. a table visual with along with Location will produce:

 

LocationRcvd
Loc115
Loc2 

 

Regards

Huge facepalm moment for me.  Of course that is the answer.  I was breaking my head on this trying to base it off my SQL query.  Thanks.

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.