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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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

Hi @Simran-Fathima ,

 

Please refer:

vcgaomsft_0-1663140891399.png

 

Best Regards,
Gao

Community Support Team

View solution in original post

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

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

 

Hi @Simran-Fathima ,

 

Please refer:

vcgaomsft_0-1663140891399.png

 

Best Regards,
Gao

Community Support Team

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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