cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mblonkatf
Frequent Visitor

Joined tables with filter returning all id's from connected table

Hi,

 

I'm trying to figure how to solve this problem, I hope one of you could help.

 

I have two tables.

table A

idmonthvalue
ajan   10
afeb15
bfeb3
cjan15
cfeb3
cmar6
capr70

 

Table B

idjanfebmarapr
a12151520
b5101010
c1551060
d20252015
e5103020

 

It is joined via id in a one(table B)-to-many(table A) relation. I would like to use the month column from table a as a filter. However I would also like to show up all id's from table B, so a, b, c, d, e and the sum of the values in regard to these months. Now I've been able to use a measure to select the values from column [jan] to the month selected from table A via the month filter. This measure is build up like this: 

if(SELECTEDVALUE('Table A'[Month])="jan";sum('Table B'[jan]);IF(SELECTEDVALUE('Table A'[Month])='feb";sum('Table B[feb]);   etc. 
 
This only returns the id's that the filter can return, which makes sense. Is there a way I could get all the values per id (a, b, c, d, e) from the jan column in Table B when I select "jan" from the month filter (table A)? And the same for feb,mar,etc.. 
 
Michel
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: Joined tables with filter returning all id's from connected table

@mblonkatf ,

 

In query editor, click on column jan, feb, mar and apr then click Transform-> Unpivot Columns, then modify the measures like:

Result =
IF (
    SELECTEDVALUE ( 'TableA'[Month] ) = "jan";
    SUM ( 'TableB'[Value] );
    IF ( SELECTEDVALUE ( 'TableA'[Month] ) = "feb"; SUM ( 'TableB'[Value] ) )
)

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

Re: Joined tables with filter returning all id's from connected table

@mblonkatf ,

 

In query editor, click on column jan, feb, mar and apr then click Transform-> Unpivot Columns, then modify the measures like:

Result =
IF (
    SELECTEDVALUE ( 'TableA'[Month] ) = "jan";
    SUM ( 'TableB'[Value] );
    IF ( SELECTEDVALUE ( 'TableA'[Month] ) = "feb"; SUM ( 'TableB'[Value] ) )
)

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks Launched March 24th!

New Ranks Launched March 24th!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power BI Community!

‘Better Together’ Contest Finalists Announced!

‘Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Arun 'Triple A' Event Video, Q&A, and Slides

Arun 'Triple A' Event Video, Q&A, and Slides

Missed the Arun 'Triple A' event or want to revisit it? We've got you covered! Check out the video, Q&A, and slides now.

Join THE global Microsoft Power Platform event series.

Join THE global Power Platform event series.

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors