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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
tmears
Helper III
Helper III

need some help on a calculated column between 2 Seperate tables which have no direct relationship

Hi

Wonder if any one out there could help me.....  I'm trying to perform a calculation over two unrelated tables, which are connected through a third table

 

Table 1 has individual transaction rows with a indivdual sales Column

Table 2 has a unique identifier of Stock Code

Table three has sales targets against Stock Codes

 

This is the relationships

Relationships.PNG

Bascailly merge 1 has indvidual lines with a profit figure, however i would like to create a calcuated column in the targets table which is a sum of the profit figure in merge 1 but based upon date and nominal code .

This is what i would like the targets table to look like, i am just missing the final colmun

outcome.PNG

 

i have got

Amount by Revenue (sum) = CALCULATE(SUM(Merge1[Profit]),RELATEDTABLE('Table11'))
 
But obviosuly doesn take into consideration dates etc
 
Any help would be great,
1 ACCEPTED SOLUTION

Hi @tmears ,

If I havne't misunderstood your requirement, you want to add the sum of 'sales table'[Profit] to target table based on the current month and nominal. For example, the following item:

PBIDesktop_TdBCGJMuxw.png

You want to get the sum of 'sales table'[Profit] in whole 2019 May, and the nominal is 4001.

In this scenario, we can use the following DAx query:

Amount by Revenue (sum) =
CALCULATE (
    SUM ( 'sales table'[Profit] ),
    FILTER (
        ALL ( 'sales table' ),
        'sales table'[DocumentHeaders.Created].[Month]
            = EARLIER ( 'target table'[Date].[Month] )
            && 'sales table'[Full Nominal List] = EARLIER ( 'target table'[Nominal] )
            && 'sales table'[DocumentHeaders.Created].[Year]
                = EARLIER ( 'target table'[Date].[Year] )
    )
)

The result will like below:

PBIDesktop_kIJfTBHvfw.png

Best Regards,

Teige

View solution in original post

3 REPLIES 3
TeigeGao
Solution Sage
Solution Sage

Hi @tmears ,

Could you please share the sample data to us for analysis? By the way, if there is no relationship between these two tables, how will the SUM() work on, the date? Based on your description, it looks like that these two tables have a many to many relationship.

Best Regards,

Teige

@TeigeGao  Please find enclosed a sample PBIX File.

 

Bascially i am trying to add a calculated column in the target table of the SUM by month of the profit column in the Sales Table.Link to Sample PBIX

 

Many thanks

T

Hi @tmears ,

If I havne't misunderstood your requirement, you want to add the sum of 'sales table'[Profit] to target table based on the current month and nominal. For example, the following item:

PBIDesktop_TdBCGJMuxw.png

You want to get the sum of 'sales table'[Profit] in whole 2019 May, and the nominal is 4001.

In this scenario, we can use the following DAx query:

Amount by Revenue (sum) =
CALCULATE (
    SUM ( 'sales table'[Profit] ),
    FILTER (
        ALL ( 'sales table' ),
        'sales table'[DocumentHeaders.Created].[Month]
            = EARLIER ( 'target table'[Date].[Month] )
            && 'sales table'[Full Nominal List] = EARLIER ( 'target table'[Nominal] )
            && 'sales table'[DocumentHeaders.Created].[Year]
                = EARLIER ( 'target table'[Date].[Year] )
    )
)

The result will like below:

PBIDesktop_kIJfTBHvfw.png

Best Regards,

Teige

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.