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
DaveRaul
New Member

Count IF between 2 tables

Hey,

 

I've tried to create a new table (table1) for counting links, if they are in the other table ( the libary-table).

If the links are in the libary, I want to know how often they are in table1.

See the picture from excel: 

Screen1

Please mind, that the libary has only the "main-parts" of the links. So I guess we have to work with asterisks.

 

Many thanks in advance,

Nick

4 REPLIES 4
v-qiuyu-msft
Community Support
Community Support

Hi @DaveRaul,

 

You can create a calculated columns in the table like below:

 

Column = var t=LEFT('Table1'[Target - URL],SEARCH("/",'Table1'[Target - URL])-1)
return
RIGHT(t,LEN(t)-SEARCH(".",t))

 

Count = IF( RELATED( 'Library'[Library -  URL] ) <> BLANK(), CALCULATE( COUNTROWS( Table1 ), ALLEXCEPT( Table1, Table1[Column] ) ) ) 

 

 

q5.PNG

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you very much for the answer.

 

I tried your code but it does not work properly 😕

I got the following problem:

If the string is extactly the same or of it is seperated by '/', it does work, .

But the code has to recognize the Url, if the Url just contains the library-Url-String. 

In Excel one can write an asterisk like: if("cde"="*d*","Yes","No")

in this case i want the response "Yes", but your code deliveres for this case "No".

 

I realised this wasn't exactly formulated. Sorry for that.

Hi @DaveRaul,

 

In DAX, it doesn't have function perform as wildcards. The DAX provided in my previous reply is based on your sample data, as you mentioned it will not work, can you please share the sample to clarify which scenario doesn't work?

 

Best Regards,
Qiuyun Yu

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
DaveRaul
New Member

Hey,

 

I want to count the target - URL's, if they exist in the Libary-table. Please see the image below:

 

I thought I can handle this with a new table and the summarize-function, but I'm stuck. I don't really care, if I have to add a new column or a new table or just a measure. The main part is, that this function has to work 🙂

 

Many thanks in advance,

Dave

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.