Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric 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 |
---|---|
88 | |
72 | |
69 | |
65 | |
57 |
User | Count |
---|---|
96 | |
92 | |
91 | |
75 | |
69 |