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

Prepping for a Fabric certification exam? Join us for a live prep session with exam experts to learn how to pass the exam. Register now.

Reply
Datagulf
Responsive Resident
Responsive Resident

Perform Aggregations(SUM) with Condition where Code Column starts with a Certain value DAX

This is data as close to the following.

Itemcode Items Value
41000 Item A 230000
41001 Item B 266000
41002 Item C 340000
41003 Item D 120000
41004 Item E 560000
41005 Item F 901000
51000 Item G 459000
51001 Item H 341000
51002 Item I 100000
51003 Item J 230000
51004 Item K 231400

 

So I would like to do a SUM of items Value where the ItemsCode startwith 41 in the Itemcode and another SUM of items Value starts with 51. 
Assist.

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Datagulf , You can create measure like

 

calculate(Sum(Table[Value]), filter(Table,left(Table[ItemCOde],2) = "41") )

 

or

 

calculate(Sum(Table[Value]), filter(Table,left(Table[ItemCOde],2) = "51") )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Datagulf , You can create measure like

 

calculate(Sum(Table[Value]), filter(Table,left(Table[ItemCOde],2) = "41") )

 

or

 

calculate(Sum(Table[Value]), filter(Table,left(Table[ItemCOde],2) = "51") )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Works Perfectly @amitchandak 

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

May 2025 Monthly Update

Fabric Community Update - May 2025

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