Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in BI by (17.6k points)

In order to Sum the sales amount of blue products OR products that belong to category shoes, I'm using the following DAX expression:

CALCULATE(

SUM(Table[SalesAmount]),

FILTER(

Table,

Table[Color] = "Blue" ||

Table[Category] = "Shoes")

)

 However, this doesn't work with two different tables (Colors and Categories), like:

CALCULATE(

SUM(Table[SalesAmount]),

FILTER(

Table,

Colors[Color] = "Blue" ||

Categories[Category] = "Shoes")

)

Can anyone help?

Thanks!

1 Answer

0 votes
by (47.2k points)
  • Searching the web led me to this forum topic. Borrowing from OwenAuger's post, I propose the following formula:

CALCULATE(SUM(Table[SalesAmount]), FILTER(SUMMARIZE(Table, Colors[Color], Categories[Category]), Colors[Color] = "Blue" || Categories[Category] = "Shoes"))

  • single table restriction is obtained by using SUMMARIZE to create a single table that has all of the pieces we need.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...