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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Get first value from column that occurs in a other column

Hi all,

 

I currently have a measure that summarizes a few rows together. These rows have the same ID, NAME, different DATES and also different PRODUCTS. At the moment, the table can show the ID & NAME paired with the DATE and summarize the VALUES. Here's my previous post for a better understanding: How can I sum all rows that have the same ID and Date? 

As said before, that table also has a PRODUCTS column. Every row has a different PRODUCT. I have a table holding specific PRODUCTS, that can only occur once per DATE/ID&NAME. Now I need a measure, that goes into the PRODUCTS-Table, search if there is any PRODUCTS in any of the selected rows and then give me that PRODUCT. If there's no match, there should be a text like "No product found".

 

Here's a example:

First we have the PRODUCTS-Table:

baltermia_edu_0-1611674308572.png

Then we have the normal table holding the data:

baltermia_edu_1-1611674620406.png

And here it is how it should look in the end:

baltermia_edu_2-1611674633756.png

 

For simplicity I did not inclue VALUE and STATUS.

 

We can take the two blue rows for example (note that there can and will be more than 2 rows for the same DATE/ID&NAME). The measure now takes the two PRODUCTS, sees if any of them are in the PRODUCTS-Table and puts the one that is in said table as value.

 

I hope it is clear what I want to achive. If not, I can update the post or comment in the thread.

 

Thanks for the help.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can first create a calculate column in the normal table to mark whether a product is in PRODUCTS table, then create a measure to get the first product value or "No product found".

Flag = IF('Table'[PRODUCT] IN VALUES(PRODUCTS[PRODUCTS]), 1, 0)

020103.jpg

MeasureProduct =
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[PRODUCT] ),
        ALLEXCEPT ( 'Table', 'Table'[ID], 'Table'[NAME], 'Table'[DATE] ),
        'Table'[Flag] = 1
    )
VAR _firstProduct =
    CALCULATE (
        FIRSTNONBLANK ( 'Table'[PRODUCT], 'Table'[PRODUCT] ),
        ALLEXCEPT ( 'Table', 'Table'[ID], 'Table'[NAME], 'Table'[DATE] ),
        'Table'[Flag] = 1
    )
RETURN
    IF ( ISBLANK ( _count ), "No product found", _firstProduct )

020104.jpg

Kindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Anonymous 

 

You can first create a calculate column in the normal table to mark whether a product is in PRODUCTS table, then create a measure to get the first product value or "No product found".

Flag = IF('Table'[PRODUCT] IN VALUES(PRODUCTS[PRODUCTS]), 1, 0)

020103.jpg

MeasureProduct =
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[PRODUCT] ),
        ALLEXCEPT ( 'Table', 'Table'[ID], 'Table'[NAME], 'Table'[DATE] ),
        'Table'[Flag] = 1
    )
VAR _firstProduct =
    CALCULATE (
        FIRSTNONBLANK ( 'Table'[PRODUCT], 'Table'[PRODUCT] ),
        ALLEXCEPT ( 'Table', 'Table'[ID], 'Table'[NAME], 'Table'[DATE] ),
        'Table'[Flag] = 1
    )
RETURN
    IF ( ISBLANK ( _count ), "No product found", _firstProduct )

020104.jpg

Kindly let me know if this helps.
Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

amitchandak
Super User
Super User

@Anonymous , Try a measure like

if(isblank(countx(filter(product, product[products]= max(Table[products])),Table[products]),"No product found",max(product[products]))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hey @amitchandak, thanks for the reply.

With "product" you mean the table in the first image right? So "Table" should be the second image.

 

When I put it in as a measure I get the following error: 


A single value for column 'products' in table 'Table' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors