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

View all the Fabric Data Days sessions on demand. View schedule

Reply
Andre96
Regular Visitor

Calculation over multiple tables

Hi all,

My goal is to combine the results of two data tables.
I have a Data model that contains four tables at all:

  • Table1: Data Table with subscription licenses for every customer for every month.
  • Table2: Data Table with sales quantity for goods sold. A customer can have multiple entries per month. There is a product and a correspoding product category.
  • uniqueTable: unique list of all customers.
  • calender: date table for model.

My goal is to count the number of relvant car customers and sum up the number of corresponding subscription licenses.

1st step is to define relevant car customers. Relevant means that they have to buy at least 100 units of car products. This targets only Table2.
2nd step is to count the number of relevant car customers. This targets only Table2.
3rd step is to sum up the number of subscription licenses of relevant car customers. This targets Table1 and Table2.

I have already found a solution for the the first two steps (maybe a bad one, but it is working).
But for the 3rd step I haven`t found a solution so far.

 

Data:

Table1:

DateCustomerSubscription Licenses
2022-01-3100110
2022-01-3100212
2022-01-3100315
2022-01-3100420
2022-02-2800111
2022-02-2800212
2022-02-2800317
2022-02-2800420

 

Table2:

DateCustomerProduct CategoryProductAmount
2022-01-31001HouseDoor100
2022-01-31001HouseRoof50
2022-01-31001CarTyre250
2022-01-31002CarTyre40
2022-01-31002CarWheel10
2022-02-28001HouseDoor80
2022-02-28001CarTyre150
2022-02-28002CarWheel120

 

uniqueTable:

Customer
001
002
003
004
...

 

calender:

Date
2022-01-31
2022-02-28

 

For step 1+2 my solution that I found so far looks as follows:

step1:

 

relevant_Car_customer = 
	
VAR _limit = 100

VAR _salesAmount
	CALCULATE(
		SUM('Table2'[Amount]),
		FILTER('Table2'[Product Category] = "Car")
	)
	
RETURN
	IF(
		_salesAmount >= _limit,
		1,
		0
	)
	

 

step2:

 

number_of_relevant_Car_customers = 

SUMX(
	VALUES('Table2'[Customer]),
	[CAR_customer]
)

 

 

The relationships are defined as follows:

  • 'Table1'[Customer] n:1 'uniqueTable'[Customer]
  • 'Table2'[Customer] n:1 'uniqueTable'[Customer]
  • 'Table1'[Date] n:1 'calender'[Date]
  • 'Table2'[Date] n:1 'calender'[Date]

 

My desired solution looks as follows:

Datenumber of customersnumber of subscription licenses
2022-01-31110
2022-02-282

23

 

Explanation:

  • 2022-01-31: 1 relevant car customer: Customer 001, because sales quantity in car is 250 (>= 100) | 002 has 50 units (< 100)
    subscription licenses: 10 (Customer 001)
  • 2022-02-28: 2 relevant car customer: Customer 001 and 002
    subscription licenses: 23 (11+12=23) (Customer 001+002)


Thank you very much for your help!
Best

Andre

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

See attached.

 

lbendlin_0-1676933926939.png

 

View solution in original post

2 REPLIES 2
Andre96
Regular Visitor

Hi @lbendlin thanks a lot for your solution. Helps me a lot!

lbendlin
Super User
Super User

See attached.

 

lbendlin_0-1676933926939.png

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors