cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
texmexdragon Post Prodigy
Post Prodigy

Sum Totals using values from two different tables

I've looked around for a solution and tried the following, but it gives me this error which I don't understand because I am not using a "true/false" expression or any boolean values:   "a function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed."

 

I am simply trying to sum the totals of the Orders in the Rebate Table, based on the values of the Orders from the Flu_Shipped table.      The Rebate Table contains a subset of order #'s from the main shipping table.   

 

The "expected" result is that the sum should equal the value of the orders(ERP) column from the Rebate Table.    

 

But what is happening, is that the sum is totaling the value of all shipments...not just the subset of orders from the Rebate Table.    The rebate table does not contain any shipping values....so it needs to pick up those values from the "shipped" table. 

 

There is a relationship between "orders" on the shipped table, and "orders(erp)" on the rebate table.  

 

Measure = CALCULATE(SUM(Flu_Shipped_2018_to_2020[Shipped Price]),FILTER(Flu_Shipped_2018_to_2020,Flu_Shipped_2018_to_2020[Date Shipped]) in VALUES('Rebate Data'[Date Approved]))
 
 
 
total.pngmodel.png
1 ACCEPTED SOLUTION

Accepted Solutions
Super User IV
Super User IV

Re: Sum Totals using values from two different tables

@texmexdragon 

The filter is closing at the wrong place

It should like this


Measure = CALCULATE(SUM(Flu_Shipped_2018_to_2020[Shipped Price]),
FILTER(Flu_Shipped_2018_to_2020,Flu_Shipped_2018_to_2020[Date Shipped] in VALUES('Rebate Data'[Date Approved])))

 

I think you might have to use treatas. In place of in values. Just explore the link

https://docs.microsoft.com/en-us/dax/treatas-function





Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
In case it does not help, please provide additional information and mark me with @
My Recent Blog -Week is not so Weak Proud to be a Super User! Connect on Linkedin


View solution in original post

2 REPLIES 2
Super User IV
Super User IV

Re: Sum Totals using values from two different tables

@texmexdragon 

The filter is closing at the wrong place

It should like this


Measure = CALCULATE(SUM(Flu_Shipped_2018_to_2020[Shipped Price]),
FILTER(Flu_Shipped_2018_to_2020,Flu_Shipped_2018_to_2020[Date Shipped] in VALUES('Rebate Data'[Date Approved])))

 

I think you might have to use treatas. In place of in values. Just explore the link

https://docs.microsoft.com/en-us/dax/treatas-function





Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
In case it does not help, please provide additional information and mark me with @
My Recent Blog -Week is not so Weak Proud to be a Super User! Connect on Linkedin


View solution in original post

texmexdragon Post Prodigy
Post Prodigy

Re: Sum Totals using values from two different tables

Hi @amitchandak 

 

The formula you gave did not work...but I beleive it was because my formula was not referencing the right fields.  

 

However, your suggestion to you use TREATAS was the perfect solution!   I literally was able to use the example formula on that page.  

 

One small issue:   The measure is returning all order #'s in the shipping table if I put that on my visual (which I need to).   How can I adjust the measure to ONLY include results where the order numbers match in both tables?   

 

You can see below, starting with Order "39"....

 

measure = CALCULATE(
SUM(Flu_Shipped_2018_to_2020[Shipped Price]),
TREATAS(VALUES(Flu_Shipped_2018_to_2020[Order]), 'Rebate Data'[Order (ERP)])
)
 
measure.png

Helpful resources

Announcements
‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

Announcing the New Spanish Forum

Announcing the New Spanish Forum

Do you need help in Spanish? Check out our new Spanish community section.

April 2020 Community Highlights

April 2020 Community Highlights

Info on our Super Users, MBAS content and badges, and updates to our support articles. - Read the full Community Highlights.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Top Solution Authors
Top Kudoed Authors