Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
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!
User | Count |
---|---|
98 | |
87 | |
77 | |
67 | |
63 |
User | Count |
---|---|
110 | |
95 | |
95 | |
64 | |
59 |