Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Arnoh
Helper III
Helper III

dax search function based on multiple values from other table

Hello,

 

I have created the following colum. 

But i would like to replace the search values by a table i have in my model.

 

 

soort klus dash = 
var mutatie  = if(SEARCH("mutatie",Werken_klussen[soort klus],,BLANK())<>BLANK(),1)
var renovatie = if(SEARCH("renovatie",Werken_klussen[soort klus],,BLANK())<>BLANK(),2)
var reparatie = if(SEARCH("reparatie",Werken_klussen[soort klus],,BLANK())+
                 SEARCH("klachtenonderhoud",Werken_klussen[soort klus],,BLANK())+
                 SEARCH("klachtonderhoud",Werken_klussen[soort klus],,BLANK())+
                 SEARCH("dagelijks",Werken_klussen[soort klus],,BLANK())
                <>BLANK(),3)

return
if(mutatie=1,1,
if(renovatie=2,2,
if(reparatie=3,3,
)))

 

 

 

The table look like

 

typedescription searach value
mutatiemutatie
reparatiereparatie
reparatieklachtenonderhoud
reparatieklachtonderhoud
reparatiedagelijks
renovatierenovatie

 

Thanx for any help.

 

Greetings

1 ACCEPTED SOLUTION

Hi @Vera_33,

 

i think i have the solution.

 

Thanx for helping.

 

soort klus dash = 
var mutatie  = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="mutatie"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),1))
var renovatie = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="renovatie"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),2))
var reparatie = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="reparatie"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),3))
var storingsdienst = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="storingsdienst"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),4))
return

View solution in original post

6 REPLIES 6
Vera_33
Resident Rockstar
Resident Rockstar

Hi @Arnoh 

 

What do you mean by replace it by a table? you have more than the search word in your original column, right? Can you use Power Query to add this column or just DAX?

 

Add this column using Text.Contains in M or Search in DAX, to put the same value in this column, then build a relationship between these two columns

description searach value

Hi @Vera_33,

 

I have te use Dax. In my current colum for example is search for "reparatie", "klachtenonderhoud", "klachtonderhoud", "dagelijks" and if found it should  give the value 3. 
The data containing these current 4 strings is dynamic. So i want to replace it with values in a separate table. 

 

I hope you understand.

 

Greetings

Vera_33
Resident Rockstar
Resident Rockstar

Hi @Arnoh 

 

I am not sure if I understand what you want...do you mean the values in that separate table will change? you want to search the values in the table?

Hi Vera_33,

 

Yes exactly. 🙂

Vera_33
Resident Rockstar
Resident Rockstar

@Arnoh  I don't think it is possible, to my understanding...

Hi @Vera_33,

 

i think i have the solution.

 

Thanx for helping.

 

soort klus dash = 
var mutatie  = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="mutatie"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),1))
var renovatie = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="renovatie"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),2))
var reparatie = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="reparatie"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),3))
var storingsdienst = CONCATENATEX(FILTER(Onderhouds_monitor_soort_klus,Onderhouds_monitor_soort_klus[soort klus]="storingsdienst"),
                if(SEARCH(FIRSTNONBLANK(Onderhouds_monitor_soort_klus[omschrijving],1),Werken_klussen[soort klus],,BLANK())<>BLANK(),4))
return

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.