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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ngct1112
Post Patron
Post Patron

DAX - Filter before Summarize

Hi All,

I would like to seek some helps for the DAX to summarize the "QTY" by "ID". However, I would like to Filter the "Status" to Ordered only before summarize.

IDQTYStatus
17Ordered
14Cancelled
22Ordered
28Cancelled
34Ordered

 

Desired outcome:

IDQTY
17
22
34

 

I am tyring with the DAX but still fail. Appreciated if you have any idea. Thanks

 

_Table = 
ADDCOLUMNS(
SUMMARIZE(FILTER('Table','Table'[Status]="Ordered"),'Table'[ID]), 
"SUM", CALCULATE(SUM('Table'[QTY])))

 

1 ACCEPTED SOLUTION
FarhanAhmed
Community Champion
Community Champion

Try

_Table = 

SUMMARIZE(FILTER('Table','Table'[Status]="Ordered"),'Table'[ID], 
"SUM", CALCULATE(SUM('Table'[QTY])))






Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
FarhanAhmed
Community Champion
Community Champion

Try

_Table = 

SUMMARIZE(FILTER('Table','Table'[Status]="Ordered"),'Table'[ID], 
"SUM", CALCULATE(SUM('Table'[QTY])))






Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!

Proud to be a Super User!




@FarhanAhmed  you solution works very fine. May I know how it is possible that your solution can still work without ADDCOLUMN?
Great thanks anyways

Jihwan_Kim
Super User
Super User

Hi,
Please try the below for creating a new table.

 

_Table =
VAR filteredtable =
FILTER ( 'Table', 'Table'[Status] = "Ordered" )
VAR newtable =
SUMMARIZE ( filteredtable, 'Table'[ID], 'Table'[QTY] )
RETURN
newtable

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.