Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
This is the column where I have to apply condition in powerbi. I need a custom column which shows the category. Condition is (1, A-B 1, Z-Z 1 ) these values will belong to category1 . Similarly category2 is (2, A-B 2, Z-Z 2) . So my data has about to 5, I can use if condition but in future there might be additional category added. So how do I apply a dynamic condition where my data is combination on text and numbers.
Solved! Go to Solution.
Hi @User1999 ,
Below is my table:
The following DAX might work for you:
Category =
var A = RIGHT('Table'[Character],1)
var B = IF(LEN('Table'[Character]) > 1 , LEFT('Table'[Character],4) , BLANK())
RETURN
IF(A < "5",CONCATENATE("Category",A),BLANK())
When subsequently adding new text, you only need to change the number of determination conditions for A
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @User1999 ,
Below is my table:
The following DAX might work for you:
Category =
var A = RIGHT('Table'[Character],1)
var B = IF(LEN('Table'[Character]) > 1 , LEFT('Table'[Character],4) , BLANK())
RETURN
IF(A < "5",CONCATENATE("Category",A),BLANK())
When subsequently adding new text, you only need to change the number of determination conditions for A
The final output is shown in the following figure:
Best Regards,
Xianda Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.