Forum Discussion
robg89
4 years agoRegular Visitor
Urgent help needed for SUM function
I am trying to create a measure whereby I sum values from one table only if a record exists in another table. See below for example. In this example, I want to sum values in the Sales table, acco...
- 4 years ago
Hi robg89 ,
If you want to create a new column:
SUM = CALCULATE ( SUM ( Sales[Value] ), FILTER ( ALL ( Sales ), Sales[Month] = EARLIER ( Sales[Month] ) && Sales[Prodect] <> BLANK () && LOOKUPVALUE ( Project[Product], Project[Product], Sales[Prodect] ) <> BLANK () ) )And if masure:
SUM1 = CALCULATE ( SUM ( Sales[Value] ), FILTER ( ALL ( Sales ), Sales[Month] = MAX ( Sales[Month] ) && Sales[Prodect] <> BLANK () && LOOKUPVALUE ( Project[Product], Project[Product], Sales[Prodect] ) <> BLANK () ) )Base table:
Output result:
Did I answer your question? Mark my post as a solution!
Best RegardsLucien
robg89
4 years agoRegular Visitor