cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ephramz
Helper II
Helper II

Help with calculated column DAX function

Table 1:

Order Number         Material Description        Quantity         Calculated Column (Total Quantity)
11111111                      Panel                              3                                       17
11111111                      Panel                              3                                       17
11111111                      Panel                              3                                       17
11111111                      Panel                              3                                       17
11112222                     Window                          4                                         0
22222222                      Spacer                            3                                        3

I want to create a calculated column (Total Quantity) which calculates the number of Quantity based on the Order Number and only calculates the quantity when the material description is either Panel or Spacer. Returns 0 if not in this material description.

What is the DAX function for this . Thanks

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@ephramz , Try a new column like

 

sumx(filter(Table, [Order Number] = earlier([Order Number]) && [Material Description] in {"Panel" , "Spacer"}),[Quantity] )



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
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

1 REPLY 1
amitchandak
Super User
Super User

@ephramz , Try a new column like

 

sumx(filter(Table, [Order Number] = earlier([Order Number]) && [Material Description] in {"Panel" , "Spacer"}),[Quantity] )



!! Microsoft Fabric !!
Microsoft Power BI Learning Resources, 2023 !!
Learn Power BI - Full Course with Dec-2022, with Window, Index, Offset, 100+ Topics !!
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!

Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors