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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
sobsawats
Frequent Visitor

SUM only same product UoM

Hi all,

I have transaction of product and its multi level product group, each product line has quantity which I want to sum it to its uppler product group. The condition of sum is if product has same UoM (unit of measurement like KG, TON, BOX), sum it to product group but if not same UoM, give zero to product group.

 

The picture of sample data and expected result below may help to describe my problem

 

I am trying to use SUM, EARLIER to solve but seems no luck

sum2 = SUMX(FILTER(txn,(txn[UNIT]=EARLIER(txn[UNIT]))&&txn[L7]=EARLIER(txn[L7])),txn[QTY])

 

Please kindly help to enlight me. Thank you

Capture.JPG

 

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@sobsawats,

 

You may add measures as follows.

QTY2 =
IF ( DISTINCTCOUNT ( txn[UNIT] ) = 1, SUM ( txn[QTY] ), 0 )
UNIT2 =
IF ( DISTINCTCOUNT ( txn[UNIT] ) = 1, MAX ( txn[UNIT] ), "NA" )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@sobsawats,

 

You may add measures as follows.

QTY2 =
IF ( DISTINCTCOUNT ( txn[UNIT] ) = 1, SUM ( txn[QTY] ), 0 )
UNIT2 =
IF ( DISTINCTCOUNT ( txn[UNIT] ) = 1, MAX ( txn[UNIT] ), "NA" )
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft

 

Thank you so much. It is easier than I can imagine. 

Capture.JPG

 

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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