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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

How to operate with unlinked tables with the same column

Hi everyone!

 

I am working in a project and I would like to multiply the number of elements within a category of two unlinked tables (which have the same categories). I show some dummy data I've just created to make it more visual. 

andresfe_0-1669995175147.png  Table 1

andresfe_1-1669995219132.png Table 2

 

My goal is representing a colum chart that has 4 columns, each one representing the product of the number of elements of each category of each table, The next image shows, what I want.

andresfe_3-1669995415402.png

 

My problem is that I've made this by creating two new tables, and I can't do that in my real project since I am using an online database by 'Analysis Services' -> 'Connect Live' so I can't create auxiliary tables/columns and modify relationships (in the original data, Category column can't be related between Table 1 and Table 2).

 

Do you know how to make this by just using measures? I leave you my dummy data.

 

https://drive.google.com/drive/folders/1otPwWGRprP-MkC-ZKMptyEYfHkF37r8D?usp=sharing

 

Thank you!!

 

 

 

 

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

 

 

 

At a very minimum you  need to have a reference table with all possible categories.  That cannot be dynamic. 

 

Then you can add a measure:

V1xV2 = 
var a = values(Categories[Cat])
var b = ADDCOLUMNS(a,"SM", var c=[Cat] return sumx(filter(Table1,[C1]=c),Table1[V1])*sumx(filter(Table2,[C1]=c),[V2]))
return sumx(b,[SM])

And then use that in your visual

lbendlin_1-1670098539444.png

 

 

View solution in original post

2 REPLIES 2
lbendlin
Super User
Super User

 

 

 

At a very minimum you  need to have a reference table with all possible categories.  That cannot be dynamic. 

 

Then you can add a measure:

V1xV2 = 
var a = values(Categories[Cat])
var b = ADDCOLUMNS(a,"SM", var c=[Cat] return sumx(filter(Table1,[C1]=c),Table1[V1])*sumx(filter(Table2,[C1]=c),[V2]))
return sumx(b,[SM])

And then use that in your visual

lbendlin_1-1670098539444.png

 

 

Anonymous
Not applicable

Thank you!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.