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
Jerush
Helper I
Helper I

join 6 - 10 tables with the same number of rows

Hi All,

I have to build a report that consolidated accounts from various DBs. I have created the data views for them and want to combine them into one report. The scenario is as below.  Each of the below is its own seperate table with the mainaccount mapping as the link between all the tables. 

Jerush_0-1712556738954.png                                                                                               

I linked each  "sub-table" to the main account table as a one- many. 

Jerush_2-1712557993162.png

The report works fine when I pull data from the 1st table, as soon as I pull a column from the second table I get the error below:

Jerush_1-1712557913047.png

I did try to merge the tables, but the values were getting duplicated. 

 

Any idea on how I can combine all the tables.

This is the end goal.

Jerush_3-1712558331962.png

Thanks all,
Jerusha

 

 

1 ACCEPTED SOLUTION
v-yilong-msft
Community Support
Community Support

Hi @Jerush ,

I’d like to acknowledge the valuable input provided by the @_AAndrade . His initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.  

In my investigation, I took the following steps:

I create three tables as you mentioned and build relationships among them. Then I create a measure and here is the DAX code.

Measure = 
VAR _CurrentMap =
    MAX ( 'T1'[Main Accout Mapping1] )
VAR _vTable =
    FILTER (
        CROSSJOIN (
            SELECTCOLUMNS ( 'T1', "_Main Accout Mapping1", 'T1'[Main Accout Mapping1] ),
            SELECTCOLUMNS (
                'T2',
                'T2'[Company1],
                "_Main Accout Mapping2", 'T2'[Main account mapping]
            ),
            SELECTCOLUMNS (
                'T3',
                'T3'[Company2],
                "_Main Accout Mapping", 'T3'[Main account mapping]
            )
        ),
        [_Main Accout Mapping] = [_Main Accout Mapping1]
            && [_Main Accout Mapping] = [_Main Accout Mapping2]
    )
RETURN
    SUMX ( FILTER ( _vTable, [_Main Accout Mapping] = _CurrentMap ), [Company1] )

Finally I get what you want.

vyilongmsft_0-1712728326759.png

vyilongmsft_1-1712728369366.png

 

 

 

Best Regards

Yilong Zhou

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

2 REPLIES 2
v-yilong-msft
Community Support
Community Support

Hi @Jerush ,

I’d like to acknowledge the valuable input provided by the @_AAndrade . His initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.  

In my investigation, I took the following steps:

I create three tables as you mentioned and build relationships among them. Then I create a measure and here is the DAX code.

Measure = 
VAR _CurrentMap =
    MAX ( 'T1'[Main Accout Mapping1] )
VAR _vTable =
    FILTER (
        CROSSJOIN (
            SELECTCOLUMNS ( 'T1', "_Main Accout Mapping1", 'T1'[Main Accout Mapping1] ),
            SELECTCOLUMNS (
                'T2',
                'T2'[Company1],
                "_Main Accout Mapping2", 'T2'[Main account mapping]
            ),
            SELECTCOLUMNS (
                'T3',
                'T3'[Company2],
                "_Main Accout Mapping", 'T3'[Main account mapping]
            )
        ),
        [_Main Accout Mapping] = [_Main Accout Mapping1]
            && [_Main Accout Mapping] = [_Main Accout Mapping2]
    )
RETURN
    SUMX ( FILTER ( _vTable, [_Main Accout Mapping] = _CurrentMap ), [Company1] )

Finally I get what you want.

vyilongmsft_0-1712728326759.png

vyilongmsft_1-1712728369366.png

 

 

 

Best Regards

Yilong Zhou

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

_AAndrade
Super User
Super User

Hi @Jerush,

 

On Power Query use append query and you will get only One table with the all information of the 6 tables.

 

Note: To use append query all your tables need to have the same structure.

 

I hope this post can help you to solve your problem 





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




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.