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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
lekkerbek
Helper IV
Helper IV

Calculate measure two different tables

Hi,

 

Can you somebody please help me with a measure?

 

I have 2 tables:

- Customers

- Transactions

 

The customer table has the following relevant columns:

- accountcode

- accountname

- candropship (true or false)

 

The transaction table has the following relevant columns:

- date

- accountcode

- amountdc

 

I would like to create a measure that calculates the total sum of all dropshipment customers.

 

I've created the following, but that doesn't work: 

CALCULATE(SUM(Transactions[AmountDC]);DimRelaties[CanDropShip]="True")
 
Thank you in advance.
1 ACCEPTED SOLUTION
az38
Community Champion
Community Champion

@lekkerbek 

your statement

calculate(sum(Transacties[AmountDC]);ALL('DimRelaties');'DimRelaties'[CanDropShip]=true())

looks pretty good to calculate total revenue by ALL customers which candropship is true

isn't it work ok? give a data example please

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

View solution in original post

5 REPLIES 5
az38
Community Champion
Community Champion

Hi @lekkerbek 

as i see your data model to calculate dropshipment customers you need something like that

calculate(countrows('Customers');ALL('Customers');'Customers'[candropship]=true())

if you need a count of transactions which made by dropshipment customers you need something like that

 

calculate(countrows('Transactions');ALL('Customers');'Customers'[candropship]=true())

and dont forget to createrelationships beween these tables

what is the table DimRelaties?

do not hesitate to give a kudo to useful posts and mark solutions as solution

 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi @az38,

 

Thank you for your suggestion. What I need is the total revenue of the dropshipment customers.

 

I tried to rewrite your code to, but I think this gives me the number of transactions rather than the revenue: calculate(sum(Transacties[AmountDC]);ALL('DimRelaties');'DimRelaties'[CanDropShip]=true())

 

Basically "transacties = transactions table" and "DimRelaties = customers table"

I forgot to translate that into English.

 

Hi @lekkerbek ,

 

Based on my test, your formula works fine with our sample data, could you please figure the difference in data model between ours and yours?

 

17.jpg18.jpg

 


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you both. I will look into this in more detail as there seems to be something wrong with my model. The loopupvalue function also gives no results.

 

At least now I know the formula is correct. Thanks.

az38
Community Champion
Community Champion

@lekkerbek 

your statement

calculate(sum(Transacties[AmountDC]);ALL('DimRelaties');'DimRelaties'[CanDropShip]=true())

looks pretty good to calculate total revenue by ALL customers which candropship is true

isn't it work ok? give a data example please

do not hesitate to give a kudo to useful posts and mark solutions as solution


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.