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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
marcoslopez
Helper I
Helper I

Sum measure from several related tables

Hi community, I need to create a measure that summarizes several fields from different tables. The issue here is that I must summarize several measures and, here the problem, a value.

My structures

Table Clients
c.ClientID
c.ClientTaxID  ([EN] Unique Tax Identification Code,  [ES] Clave Única de Identificación Tributaria)
c.CreditLimit   (Here i have 1 credit limit by client)

Table Checks     (Several checks by client)
ch.ClientId
ch.OperationID
ch.Total

Table CustomerDebt    (Several movements by client)
cd.ClientID
cd.OperationID
cd.Total

Table Orders     (Several orders by client)
o.ClientID
o.OrderID
o.Total


What i need to sum is, per client, sth like:
Resume = c.CreditLimit - sum(ch.Total) - sum(cd.Total) - sum(o.Total)

How might I be able to obtain that formula?


Best Regards,
Marcos

2 ACCEPTED SOLUTIONS
edhans
Super User
Super User

Unless I am not understanding your problem this will just work once you create the relationshipes between the tables to a DIM table that has your client info. Create a SUM() measure for each type of data (checks, orders, etc) then one more measure that just adds/subtracts the measures.

 

When you put your client ID from the FACT table in a Table or Pivot visual, then the master measure that has your "resume" math, the row context of the pivot will make it work.

 

If I am totally missing your issue, please post a PBIX file with some sample data in it so we can see what is really going on.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

@edhans thanks, that helps.

That I've done is to create measures in respective fact tables and call them from dim Client.

Measure_TotalChecks = sum(ch.total)
Measure_TotalDebt = sum(cd.total)
Measure_TotalOrders = sum(o.total)

In Client table i calculate as column the totals what i needed

ClientRisk = c.CreditLimit - Measure_TotalChecks - Measure_TotalDebt - Measure_TotalOrders 


Best Regards, Marcos

View solution in original post

3 REPLIES 3
marcoslopez
Helper I
Helper I

Hi community, I need to create a measure that summarizes several fields from different tables. The issue here is that I must summarize several measures and, here the problem, a value.

My structures

Table Clients
c.ClientID
c.ClientTaxID  ([EN] Unique Tax Identification Code,  [ES] Clave Única de Identificación Tributaria)
c.CreditLimit   (Here i have 1 credit limit by client)

Table Checks     (Several checks by client)
ch.ClientId
ch.OperationID
ch.Total

Table CustomerDebt    (Several movements by client)
cd.ClientID
cd.OperationID
cd.Total

Table Orders     (Several orders by client)
o.ClientID
o.OrderID
o.Total


What i need to sum is, per client, sth like:
Resume = c.CreditLimit - sum(ch.Total) - sum(cd.Total) - sum(o.Total)

How might I be able to obtain that formula?


Best Regards,
Marcos

edhans
Super User
Super User

Unless I am not understanding your problem this will just work once you create the relationshipes between the tables to a DIM table that has your client info. Create a SUM() measure for each type of data (checks, orders, etc) then one more measure that just adds/subtracts the measures.

 

When you put your client ID from the FACT table in a Table or Pivot visual, then the master measure that has your "resume" math, the row context of the pivot will make it work.

 

If I am totally missing your issue, please post a PBIX file with some sample data in it so we can see what is really going on.



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

@edhans thanks, that helps.

That I've done is to create measures in respective fact tables and call them from dim Client.

Measure_TotalChecks = sum(ch.total)
Measure_TotalDebt = sum(cd.total)
Measure_TotalOrders = sum(o.total)

In Client table i calculate as column the totals what i needed

ClientRisk = c.CreditLimit - Measure_TotalChecks - Measure_TotalDebt - Measure_TotalOrders 


Best Regards, Marcos

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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