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.
Hi
I would like to create a formula which can apply a string filter on CALCULATE.
For instance, I would like to sum all units where names include the string "Rab", I was thinking of the following formula but wonder if there is a more optimised solution, many thanks for your help:
=CALCULATE(SUM([Units]),OR(OR([Name]="Rabbit",[Name]="Rab/Cat"),[Name]="Rab/Dog"))
Datatable:
Name Units
Rabbit 4
Turtle 2
Dog 3
Cat 1
Rab/Cat 5
Rab/Dog 4
Solved! Go to Solution.
@wagrezy Please try search or containstring function to get the desired output.
Measure = CALCULATE(SUM('Table'[units]),SEARCH("Rab",'Table'[Name],1,0)>0)
@wagrezy Please try search or containstring function to get the desired output.
Measure = CALCULATE(SUM('Table'[units]),SEARCH("Rab",'Table'[Name],1,0)>0)
Works perfectly, thank you!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |