cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Resolver I

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]
)

4 REPLIES 4
Frequent Visitor

That worked thanks so much!

Resolver I

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

Frequent Visitor

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.

Resolver I

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]
)

Announcements

#### Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors