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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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.


Go to My LinkedIn Page


Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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