Forum Discussion
Syndicate_Admin
4 years agoAdministrator
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 c...
- 4 years ago
Try:
BAG QUANTITY = CALCULATE ( SUM ( GVA53[QUANTITY] ), FILTER ( GVA53, LEFT ( GVA53[GVV12. COD_CLIENT], 1 ) = "B" || LEN ( GVA53[GVV12. COD_CLIENT] >= 5 ) ) )
amitchandak
4 years agoSuper User
Syndicate_Admin , Try a measure like
calculate(count(Table[Column]), filter(Table, left(Table[Code],1) = "B" && len(Table[Code]) >=5))
- Syndicate_Admin4 years agoAdministrator
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:Fields have the following type:
QUANTITY = DECIMAL NUMBER
COD_CLIENT = TEXT
Sipudieras help me, it would be great. Thanks a lot
Marcela Martinez Pagola
- PaulDBrown4 years agoCommunity Champion
Try:
BAG QUANTITY = CALCULATE ( SUM ( GVA53[QUANTITY] ), FILTER ( GVA53, LEFT ( GVA53[GVV12. COD_CLIENT], 1 ) = "B" || LEN ( GVA53[GVV12. COD_CLIENT] >= 5 ) ) )