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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Jorjor
Frequent Visitor

Calculate QTY for a two part IF function

I want to calculate the QTY for each component in my data set. The forumula I'm using is only calculating for the top item not all of them.

 

BOM Q = SUMX(FILTER('All Demand',[BOM ID]=EARLIER('WORKORDERS_OPEN'[BOM ID]) && [Component]=EARLIER('WORKORDERS_OPEN'[Component])),[BOM QTY]*[REPORTREMAINASFINISHED])
 
BOM QTY.PNGBOM QTY 2'.PNG
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Jorjor ,

 

You can try formula like below to calculate QTY = Remanin finish * BOM QTY:

QTY 1 =
VAR CurrentBOMID = 'RemainingFinishTable'[BOM ID]
VAR CurrentComponent = 'RemainingFinishTable'[Component]
VAR BOMQTY =
    CALCULATE (
        SUM ( 'BOMTable'[BOM QTY] ),
        FILTER (
            'BOMTable',
            'BOMTable'[BOM ID] = CurrentBOMID
                && 'BOMTable'[Component] = CurrentComponent
        )
    )
RETURN
    BOMQTY * 'RemainingFinishTable'[Remain Finish]

vkongfanfmsft_1-1719899284812.png

Best Regards,
Adamk Kong

 

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Jorjor ,

 

You can try formula like below to calculate QTY = Remanin finish * BOM QTY:

QTY 1 =
VAR CurrentBOMID = 'RemainingFinishTable'[BOM ID]
VAR CurrentComponent = 'RemainingFinishTable'[Component]
VAR BOMQTY =
    CALCULATE (
        SUM ( 'BOMTable'[BOM QTY] ),
        FILTER (
            'BOMTable',
            'BOMTable'[BOM ID] = CurrentBOMID
                && 'BOMTable'[Component] = CurrentComponent
        )
    )
RETURN
    BOMQTY * 'RemainingFinishTable'[Remain Finish]

vkongfanfmsft_1-1719899284812.png

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Still getting the same error think it is an issue with my data as a whole thanks for the help.

rajendraongole1
Super User
Super User

Hi @Jorjor -create a measure to calculate the QTY for each component

 

QTY Measure =
SUMX(
FILTER(
'All Demand',
'All Demand'[BOM ID] = 'WORKORDERS_OPEN'[BOM ID]
&& 'All Demand'[Component] = 'WORKORDERS_OPEN'[Component]
),
'All Demand'[BOM QTY] * 'WORKORDERS_OPEN'[REPORTREMAINASFINISHED]
)

 

Hope it works for both components.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi this is having the same issue it is only returning the top value of the BOM not all of the values for each component.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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