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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply

calculations within non-related tables

hey,

 

I have to tables from two different sources and one column contains a text which contains an ID that is defined in another table. 

(I cannot publish a Message with tables - i am getting errors)

 

Source 1:

Company Name          Sponsor (SP-ID)            NL-ID

kuwerhgidufg              SP0001                        NL-0001

keurghk                       SP0002                        NL-0008

...                                   ....                                .....

 

Source 2 (Newsletter):

Title                       Openers                 URL

ifuwarhefkl             267                     htt...text...NL-0001... .

luadrhoi                  23829                 htt.....NL-0008...

iufhsdfkön             12882                  htt... NL-0001

...                             ...                           ...

 

-> I would like to have a third table or measurement that results in:

Sponsors             Total Openers

SP0001                13.149

SP0002                 .....

 

 

The problem is that these to tables so far cannot be related in any way.

 

In excel I would build something like "if Column [URL] contains [NL-ID] then sum up column [Openers]"

 

I am looking forward to solutions! 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@SarahAlsterspre , You can have column like this in a table 1

sumx(filter(Newsletter, search( Source1[NL-ID], Newsletter[URL],,0)>0),Source1[Openers])

 

refer: https://www.youtube.com/watch?v=czNHt7UXIe8

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@SarahAlsterspre , You can have column like this in a table 1

sumx(filter(Newsletter, search( Source1[NL-ID], Newsletter[URL],,0)>0),Source1[Openers])

 

refer: https://www.youtube.com/watch?v=czNHt7UXIe8

westwrightj
Resolver III
Resolver III

Hey @SarahAlsterspre ,

 

    Okay, so I think I see what you are going for here and there are a few different ways you can go about it. The solution I've provided is not the most eqloquent or complex but should meet the outcome you listed.

 

I've used the following sample data for this solution

 

westwrightj_0-1605533861171.png

 

westwrightj_1-1605533872640.png

 

So we can actually make a measure like the following to get the outcome table you were looking for without connecting anything. In this case this measure would only work properly in a table format and in this example is calculating the average opener number

 

TheMeasurement = 

var TheNL_ID = MAX('Source 1'[NL-ID])

return

CALCULATE(AVERAGE('Source 2'[Openers]), CONTAINSSTRING('Source 2'[URL], TheNL_ID))

 

 

 

westwrightj_2-1605534366542.png

 

Let me know if that solution works or if we want to go back and tinker with it some more

 

 

 

camargos88
Community Champion
Community Champion

@SarahAlsterspre ,

 

You can use this measure:

 

_Openers = 
VAR _ndID = SELECTEDVALUE('Table'[NL-ID])
RETURN CALCULATE(SUM('Table (2)'[Openers]), CONTAINSSTRING('Table (2)'[URL], _ndID))

 

Capture.PNG

 

If you have a patterns, you can split the url column and related both tables, avoid any problem.

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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