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

Custom column in Power Query to check groupings of rows

Hi team, I'm hoping someone might be able to help.

I have a table showing various files ("URL" column), some with labels ("Label" column), and some without. Some files have multiple labels, and there are sometimes multiple rows for each file.

I need to create a custom column in Power Query that looks through each grouping of URLs and tells me whether the grouping contains a label or not. Here's an example of the output I need:

URLLabelContains Label
File1Lable.ArchivedYes
File2Label.CustomersYes
File2Label.ActiveYes
File3 Yes
File3Label.StaffYes
File3 Yes
File4 No
File4 No
File4 No
File5 No


Any help would really be appreciated 🙂

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi  @MichaelHutchens ,

 

You can also use the dax function to.

Here are the steps you can follow:

1. Create calculated column.

Contains Label =
var _count=
COUNTX(FILTER(ALL('Table'),'Table'[URL]=EARLIER('Table'[URL])&&'Table'[Label]<>BLANK()),[Label])
return
IF(
    _count>=1,"Yes","No")

2. Result:

vyangliumsft_0-1669706701501.png

 

Best Regards,

Liu Yang

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

Thanks so much @Anonymous , that solutions works just fine 🙂 Appreciate your time!

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @MichaelHutchens ,

 

You can also use the dax function to.

Here are the steps you can follow:

1. Create calculated column.

Contains Label =
var _count=
COUNTX(FILTER(ALL('Table'),'Table'[URL]=EARLIER('Table'[URL])&&'Table'[Label]<>BLANK()),[Label])
return
IF(
    _count>=1,"Yes","No")

2. Result:

vyangliumsft_0-1669706701501.png

 

Best Regards,

Liu Yang

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

Thanks so much @Anonymous , that solutions works just fine 🙂 Appreciate your time!

Hi @amitchandak , thanks so much for responding. I'm getting an error with that code:

MichaelHutchens_0-1669651513124.png

 

amitchandak
Super User
Super User

@MichaelHutchens , Try a new column in power query

let
_col = [URL],
_table = Table.SelectRows(Ranges, each [URL] = _col and [Label] <> null ),
_count = if Table.RowCount(_table[Label]) >=1 then "Yes" else "No"
in
_count

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

Helpful resources

Announcements
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!

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.

Top Solution Authors