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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Simran-Fathima
Frequent Visitor

Replacement of CONTAINSROW function in Power BI Direct query

I have two columns "Company A products" and "Company B products". Now I want to create a "Results" column which contains only those "Company A products" that are also present in "Company B products". I was tring to do it using CONTAINSROW function but I'm using direct query mode so CONTAINSROW function is not supported. Can anyone guide me how can I achieve this in power BI Direct query mode. I have attached a screenshot for better understanding of my requirement.

 

SimranFathima_0-1663078844219.png

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Simran-Fathima ,

 

Please refer:

vcgaomsft_0-1663140891399.png

 

Best Regards,
Gao

Community Support Team

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @Simran-Fathima ,

 

The use of calculated columns in DQ mode has many limitations and it is recommended to use measure to solve this problem.

Measure = 
VAR _a = 
MAX('Table'[Company A Products])
VAR _result = 
CALCULATE(
    COUNT('Table'[Company B Products]),
        FILTER(
            ALL('Table'),
            'Table'[Company B Products]=_a
        )
)
RETURN
_result

vcgaomsft_0-1663135589226.png

DirectQuery in Analysis Services 2016 - SQLBI

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

I didnt get the desired output. And in the filter also I'm unable to change it to "is not blank". Can u help me out. I'm sharing the screenshot of what i got

 

SimranFathima_0-1663140580007.png

 

Anonymous
Not applicable

Hi @Simran-Fathima ,

 

Please refer:

vcgaomsft_0-1663140891399.png

 

Best Regards,
Gao

Community Support Team

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.