cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
Antje
Frequent Visitor

Match across multiple rows and columns

I'm new to Power Bi and trying to create a formula that will return an equipment number if:

Antje_0-1647281354795.png

- an equipment number in column Equipment is listed more than once  AND
- at least one line of the matching equipment numbers under column Location has "Showroom" or "Training" AND
- at least one line of the matching equipment numbers under column Invoice Date has a date AND
- at least one line of the matching equipment numbers under column Order Type has the keyword "Sale"



1 ACCEPTED SOLUTION
Samarth_18
Community Champion
Community Champion

Hi @Antje , 

 

Create a custom column with below code and use it as filter on your visual:-

 

Column =
VAR _count =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
        )
    )
VAR _location =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
                && 'Table (5)'[Location] IN { "Showroom", "Location" }
        )
    )
VAR _invoice_Date =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
                && 'Table (5)'[Invoice date] <> BLANK ()
        )
    )
VAR _ordertype =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
                && 'Table (5)'[Order type] IN { "Sale" }
        )
    )
RETURN
    IF (
        _count >= 2
            && _location >= 1
            && _invoice_Date >= 1
            && _ordertype >= 1,
        1,
        0
    )

 

Samarth_18_0-1647287206199.png

output:-

Samarth_18_1-1647287255127.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

View solution in original post

2 REPLIES 2
Antje
Frequent Visitor

Thank you so much, Samarth! This worked perfectly.

Samarth_18
Community Champion
Community Champion

Hi @Antje , 

 

Create a custom column with below code and use it as filter on your visual:-

 

Column =
VAR _count =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
        )
    )
VAR _location =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
                && 'Table (5)'[Location] IN { "Showroom", "Location" }
        )
    )
VAR _invoice_Date =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
                && 'Table (5)'[Invoice date] <> BLANK ()
        )
    )
VAR _ordertype =
    COUNTROWS (
        FILTER (
            'Table (5)',
            'Table (5)'[Eqipment] = EARLIER ( 'Table (5)'[Eqipment] )
                && 'Table (5)'[Order type] IN { "Sale" }
        )
    )
RETURN
    IF (
        _count >= 2
            && _location >= 1
            && _invoice_Date >= 1
            && _ordertype >= 1,
        1,
        0
    )

 

Samarth_18_0-1647287206199.png

output:-

Samarth_18_1-1647287255127.png

 

Thanks,

Samarth

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors