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
Anonymous
Not applicable

Group by calculated column

I have the below table, I need to create a calculated column "Overall Product and Trn  Sales",  which will be the sum of SalesAmount for the Trn ID and Product ID summarized.

Trn IDBrandLocationProduct IDSalesAmountOverall Product and Trn  Sales
1aUS15 
2bUK110 
2cCA110 
1dIN110 
3eDE110 

 

Resultant column should look like the below:

 

may_bi_3-1633339930015.png

 

The below measure worked, 

Overall Product and Trn  Sales =
var maxdd=MAX(table[Trn ID]])

var TotalSales=
CALCULATE(
SUM(Table[SalesAmount]),
table[Trn ID]]=maxdd,
ALLEXCEPT(table,table[Product ID])
)
return
TotalSales

 

Could someone please let me know how the dax for calculated column should be?

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create a new column like

SUMX(filter(Table, table[Trn ID] = earlier (Trn ID)), Table[SalesAmount])

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , Create a new column like

SUMX(filter(Table, table[Trn ID] = earlier (Trn ID)), Table[SalesAmount])

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.