Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Dear experts,
I'm trying to create a measure that filter 2 columns of the same table using the "SEARCH"
Measure 12 =
CALCULATE(CALCULATE(DISTINCTCOUNT(Cases[CaseID]);
FILTER( ALL(Cases);
(SEARCH("Accident"; Cases[Event];;BLANK())) ||
(SEARCH("Extraordinary"; Cases[Cover];;BLANK())) ||
(SEARCH("Information"; Cases[Cover];;BLANK()))))
As you can see, I'm trying to get the cases where the column Event containts "Accident" or the column Cover contains "Extraordinary" or "Information".
Is it possible to do this in a measure?
Solved! Go to Solution.
try to take all Cases into ordinary quota:
Column =
IF(
(SEARCH("Accident"; 'Cases'[Event];;0) + SEARCH("Extraordinary"; 'Cases'[Cover];;0) +
SEARCH("Information"; 'Cases'[Cover];;0) > 0;
1;
BLANK()
)
or remove Cases at all
Column =
IF(
(SEARCH("Accident"; [Event];;0) + SEARCH("Extraordinary"; [Cover];;0) + SEARCH("Information"; [Cover];;0) > 0;
1;
BLANK()
)
Try like
Measure 12 =
CALCULATE(CALCULATE(DISTINCTCOUNT(Cases[CaseID]);
FILTER( ALL(Cases);
(SEARCH("Accident"; Cases[Event];1;0)>0) ||
(SEARCH("Extraordinary"; Cases[Cover];1;0)>0) ||
(SEARCH("Information"; Cases[Cover];1;0)>0))))
Hi @setis
try more simple
Measure 12 =
CALCULATE(CALCULATE(DISTINCTCOUNT(Cases[CaseID]);
FILTER( ALL(Cases);
SEARCH("Accident"; Cases[Event]) > 0 ||
SEARCH("Extraordinary"; Cases[Cover]) > 0 ||
SEARCH("Information"; Cases[Cover]) > 0
))
Ok
try
Measure 12 =
CALCULATE(CALCULATE(DISTINCTCOUNT(Cases[CaseID]);
FILTER( ALL(Cases);
SEARCH("Accident"; Cases[Event];;0) > 0 ||
SEARCH("Extraordinary"; Cases[Cover];;0) > 0 ||
SEARCH("Information"; Cases[Cover];;0) > 0
))
Thanks for your help. It's not working for me.
I'm getting an unrealistic number and when a place the measure on a table with the CaseID, I'm getting the same number in all rows.
Please find a dummy file here https://drive.google.com/file/d/1-e0pVtF0N5uJ2zOO4_cfYcAM-ctFQsNe/view?usp=sharing
The expected result is this:
Thanks in advance
wow. it look a little bit other task
you need this trigger row-by-row?
maybe you need a simple column ?
Column =
IF(
(SEARCH("Accident"; Cases[Event];;0) + SEARCH("Extraordinary"; Cases[Cover];;0) +
SEARCH("Information"; Cases[Cover];;0) > 0;
1;
BLANK()
)
Thanks @az38 ,
Yes, I need it on a row by row.
I'm getting a syntax error with the column you sent. Can you see what's wrong?
try to take all Cases into ordinary quota:
Column =
IF(
(SEARCH("Accident"; 'Cases'[Event];;0) + SEARCH("Extraordinary"; 'Cases'[Cover];;0) +
SEARCH("Information"; 'Cases'[Cover];;0) > 0;
1;
BLANK()
)
or remove Cases at all
Column =
IF(
(SEARCH("Accident"; [Event];;0) + SEARCH("Extraordinary"; [Cover];;0) + SEARCH("Information"; [Cover];;0) > 0;
1;
BLANK()
)
Thank you! It works now.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 56 | |
| 33 | |
| 32 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 65 | |
| 64 | |
| 44 | |
| 30 | |
| 28 |