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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.