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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
awitt
Helper III
Helper III

Multiple Field Filter Calculation

I have an orders table that consits of often times multiple items per order. What I am trying to accomplish is identifying when all the items in the order were "filled" in time and assigning a 1 or 0 to the entire order, not just the individual items. The data table is structured to where each record is an item or "OrderItemId" and there can be mulitple records for each "OrderID". What I need is to return a 0 if there is any instance of a 0 on the item fill column. 

 

For example for OrderID 12340036 only two items were filled in time so all values in the "Calculated" column should return 0.  The next step would be to add a filter that would exclude certain characteristics. For instance remove "Widget 2" from this logic entirely and only evaluate the other items when determining if the order was filled. 

 

Capture.PNG

PBIX file is attached. 

 

Sample PBIX File 

 

 
1 ACCEPTED SOLUTION

Hi , @awitt 

Sorry for later reply.

According to your description , maybe we need to use measure rather than calculated column.

Here is a demo.

pbix attached

 

If help ,try steps as below:

1.Create calculate table as a slicer

Table = DISTINCT('TempTable'[Product])

 

2.create measure as below" ,put it into the visual table

Measure = if(CALCULATE(COUNTROWS('TempTable'),FILTER(ALLSELECTED(TempTable),'TempTable'[OrderID] in DISTINCT('TempTable'[OrderID]) && 'TempTable'[OrderItem Fill Y/N] =0))>0,0,1)

Create measure  "visual control" ,put it into table visual filter pane as below:

visual control = 
 IF(DISTINCTCOUNT('Table'[Product]) <> CALCULATE(DISTINCTCOUNT('Table'[Product]),ALL('Table')),
IF(SELECTEDVALUE(TempTable[Product]) in DISTINCT('Table'[Product]),1,-1)
,-1)

70.png

 

3.create measure slicer visual control as below ,put it into slicer filter pane

Slicer Visual Control = IF(SELECTEDVALUE('Table'[Product]) in DISTINCT('TempTable'[Product]),1,-1)

71.png

 

 

 

Best Regards,
Community Support Team _ Eason
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
v-easonf-msft
Community Support
Community Support

Hi, @awitt 

If help ,change your measures  "calculated"as below:

Calculated =
VAR i = [OrderID]
RETURN
    IF (
        CALCULATE (
            COUNTROWS (
                FILTER (
                    ALL ( 'TempTable' ),
                    'TempTable'[OrderID] = i
                        && TempTable[OrderItem Fill Y/N] = 0
                )
            )
        ) > 0,
        0,
        1
    )

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-easonf-msft Thanks! 

 

Do you have an idea how to answer the second part where you are filtering a certain subset of the data. The example I think was to make this calculation but not include the results for "widget 2" in the calculation. 

Hi , @awitt 

Sorry for later reply.

According to your description , maybe we need to use measure rather than calculated column.

Here is a demo.

pbix attached

 

If help ,try steps as below:

1.Create calculate table as a slicer

Table = DISTINCT('TempTable'[Product])

 

2.create measure as below" ,put it into the visual table

Measure = if(CALCULATE(COUNTROWS('TempTable'),FILTER(ALLSELECTED(TempTable),'TempTable'[OrderID] in DISTINCT('TempTable'[OrderID]) && 'TempTable'[OrderItem Fill Y/N] =0))>0,0,1)

Create measure  "visual control" ,put it into table visual filter pane as below:

visual control = 
 IF(DISTINCTCOUNT('Table'[Product]) <> CALCULATE(DISTINCTCOUNT('Table'[Product]),ALL('Table')),
IF(SELECTEDVALUE(TempTable[Product]) in DISTINCT('Table'[Product]),1,-1)
,-1)

70.png

 

3.create measure slicer visual control as below ,put it into slicer filter pane

Slicer Visual Control = IF(SELECTEDVALUE('Table'[Product]) in DISTINCT('TempTable'[Product]),1,-1)

71.png

 

 

 

Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

Sounds like you want On Time In Full. I thought I had posted that to the quick measure gallery. Apparently not, I know it is in my upcoming book. I will take a look at your PBIX and see if I can apply it.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.