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
dshmulenson
New Member

Check if quantity equals in rows with same id

Hi,

im currenty using report server and i have this table:

Item IDQuantityStatus
12available
12available
33Issue
34invalid

I would like to add a column which can identify if quantity is equals when its same "Item ID" AND checks if Status is "Available".

Earlier Function didnt work cause the table doesnt has logical order for this function.

Thank in Advanced

 

 

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

Hi @dshmulenson ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1709002112100.png

2. create a new column with below dax formula

IsQuantityEqualForAvailableStatus =
VAR currentItemID = 'Table'[Item ID]
VAR currentQuantity = 'Table'[Quantity]
VAR availableItemsSameID =
    FILTER (
        ALL ( 'Table' ),
        'Table'[Item ID] = currentItemID
            && 'Table'[Status] = "available"
    )
RETURN
    IF (
        COUNTROWS ( availableItemsSameID ) > 1
            && CALCULATE ( MIN ( 'Table'[Quantity] ), availableItemsSameID ) = currentQuantity
            && CALCULATE ( MAX ( 'Table'[Quantity] ), availableItemsSameID ) = currentQuantity,
        "Yes",
        "No"
    )

vbinbinyumsft_1-1709002208299.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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-binbinyu-msft
Community Support
Community Support

Hi @dshmulenson ,

Please try below steps:

1. below is my test table

Table:

vbinbinyumsft_0-1709002112100.png

2. create a new column with below dax formula

IsQuantityEqualForAvailableStatus =
VAR currentItemID = 'Table'[Item ID]
VAR currentQuantity = 'Table'[Quantity]
VAR availableItemsSameID =
    FILTER (
        ALL ( 'Table' ),
        'Table'[Item ID] = currentItemID
            && 'Table'[Status] = "available"
    )
RETURN
    IF (
        COUNTROWS ( availableItemsSameID ) > 1
            && CALCULATE ( MIN ( 'Table'[Quantity] ), availableItemsSameID ) = currentQuantity
            && CALCULATE ( MAX ( 'Table'[Quantity] ), availableItemsSameID ) = currentQuantity,
        "Yes",
        "No"
    )

vbinbinyumsft_1-1709002208299.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

You should be able to group across these three columns and then return all the groups where the rowcount is greater than 1.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.