Forum Discussion
AllanBerces
3 months agoPost Prodigy
Sum with Condition
Hi can someone correct my calculated column. On my table if the Type is Object the equal to Needed but if the type is Article i want the sum of Needed base from ArtNo. and JobNo. Sample JobNo. CCCC...
- 3 months ago
Hi AllanBerces
Can you try this calculation
Total Quantity =
IF('Table'[Type] = "Object", 'Table'[Needed],
CALCULATE(SUM('Table'[Needed]),
FILTER('Table',
'Table'[JobNo] = EARLIER('Table'[JobNo]) &&
'Table'[ArtNo.] = EARLIER('Table'[ArtNo.]) &&
'Table'[Type] = "Article")))
- 3 months ago
hi AllanBerces
Try this:
Total Qty = VAR _job = 'Table'[JobNo] VAR _art = 'Table'[ArtNo.] RETURN SWITCH ( 'Table'[Type], "Object", 'Table'[Needed], "Article", SUMX ( FILTER ( 'Table', 'Table'[ArtNo.] = _art && 'Table'[JobNo] = _job ), [Needed] ) ) - 3 months ago
Hi AllanBerces,
Try below Dax to create a calculated column:-
Total Quantity =VAR _Type = 'Table'[Type]VAR _Job = 'Table'[JobNo]VAR _Art = 'Table'[ArtNo]
RETURNIF (_Type = "Object",'Table'[Needed],CALCULATE (SUM ( 'Table'[Needed] ),FILTER ('Table','Table'[JobNo] = _Job&& 'Table'[ArtNo] = _Art&& 'Table'[Type] = "Article")))Also refer attached .pbix file with solution.๐ I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
๐ก Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
๐ As a proud SuperUser and Microsoft Partner, weโre here to empower your data journey and the Power BI Community at large.
๐ Curious to explore more? [Discover here].
Letโs keep building smarter solutions together! - 3 months ago
Please try the calculated column below:
Total Quantity = IF ( 'Table'[Type] = "Object", 'Table'[Needed], CALCULATE ( SUM ( 'Table'[Needed] ), ALLEXCEPT ( 'Table', 'Table'[ArtNo.], 'Table'[JobNo.] ), 'Table'[Type] = "Article" ) )
krishnakanth240
3 months agoSuper User
Hi AllanBerces
Can you try this calculation
Total Quantity =
IF('Table'[Type] = "Object", 'Table'[Needed],
CALCULATE(SUM('Table'[Needed]),
FILTER('Table',
'Table'[JobNo] = EARLIER('Table'[JobNo]) &&
'Table'[ArtNo.] = EARLIER('Table'[ArtNo.]) &&
'Table'[Type] = "Article")))