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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
Syndicate_Admin
Administrator
Administrator

Filter code by 2 conditions

Nice day

I need to filter the clients in Transforar Data whose code begins with the letter B and also those whose code is more than 5 characters long. This company has very different codes for its customers and in this case I need to see only those that meet one of these 2 conditions. Of course, I appreciate your help.

1 ACCEPTED SOLUTION

Try:

BAG QUANTITY =
CALCULATE (
    SUM ( GVA53[QUANTITY] ),
    FILTER (
        GVA53,
        LEFT ( GVA53[GVV12. COD_CLIENT], 1 ) = "B"
            || LEN ( GVA53[GVV12. COD_CLIENT] >= 5 )
    )
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Syndicate_Admin , Try a measure like

 

calculate(count(Table[Column]), filter(Table, left(Table[Code],1) = "B" && len(Table[Code]) >=5))

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

Good afternoon

I put together this formula as you told me (I tried the same with COUNT and the same thing happens)

BAG QUANTITY = CALCULATE(SUM(GVA53[QUANTITY]), GVA53, LEFT(GVA53[GVV12. COD_CLIENT], 1) = "B" || LEN(GVA53[GVV12. COD_CLIENT] >= 5))
and when I add it to a table, it returns this message to me:
MMPagola_0-1631641223080.png

Fields have the following type:

QUANTITY = DECIMAL NUMBER

COD_CLIENT = TEXT

Sipudieras help me, it would be great. Thanks a lot

Marcela Martinez Pagola

Try:

BAG QUANTITY =
CALCULATE (
    SUM ( GVA53[QUANTITY] ),
    FILTER (
        GVA53,
        LEFT ( GVA53[GVV12. COD_CLIENT], 1 ) = "B"
            || LEN ( GVA53[GVV12. COD_CLIENT] >= 5 )
    )
)




Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.