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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
NPatel12498
Frequent Visitor

How to sum rows based on values starting with 2 different numbers

Hi,

 

I am trying to do a calculation within a column that takes the sum of all the raw costs where the Org name starts with either a "1" or a "3" and the Cost Category = Regular Labor

 

This is the formula that I have but not sure if it is correct:

S&T Labor = 
CALCULATE(
	SUM('Raw Costs'[ACCT_RAW_COST]),
	'Raw Costs'[ICE_MODEL_COST_CATEGORY]= "Regular Labor" && OR(LEFT('Raw Costs'[ORG_NAME],1) = "1", LEFT('Raw Costs'[ORG_NAME],1)="3")
)

  

1 ACCEPTED SOLUTION

Try to create DAX Measure and check :

TotalRegularLabor :=
SUMX (
FILTER (
YourTable,
(LEFT(YourTable[Org Name], 1) = "1" || LEFT(YourTable[Org Name], 1) = "3") &&
YourTable[Cost Category] = "Regular Labor"
),
YourTable[Amount]
)

View solution in original post

4 REPLIES 4
NPatel12498
Frequent Visitor

That worked thanks so much!

VN999
Resolver I
Resolver I

Please provide more deatils with some example data to understand requirement correctly?

HI, I need to take the sum of all of the rows where the Org Name starts with "1" or "3" and has a Cost Category = "Regular Labor".. in the screenshot below, it would be $6,327,373 + $264,953 = $6,592,326.

 

NPatel12498_0-1719871346867.png

 

Try to create DAX Measure and check :

TotalRegularLabor :=
SUMX (
FILTER (
YourTable,
(LEFT(YourTable[Org Name], 1) = "1" || LEFT(YourTable[Org Name], 1) = "3") &&
YourTable[Cost Category] = "Regular Labor"
),
YourTable[Amount]
)

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.