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
Ashwin_Wadalkar
Frequent Visitor

how to get total of few selected materials

Hi,

I have 100 + material codes & I want to get Sales of selected materials.

I gets sales of a single material code with below formula in "New Measure"

Sales = Calculate CALCULATE(([Sales Amt],(Sheet1[Material Code]="100495")

But, I fails with multiple material codes ;

Sales = Calculate CALCULATE(([Sales Amt],(Sheet1[Material Code]="100495","100395","100503")

Error.

 

Please advice.

Thanks in advance

Ashley

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Ashwin_Wadalkar 

Use it this way:

Sales = 
CALCULATE(
    [Sales Amt],
    Sheet1[Material Code] IN {"100495","100395","100503"}
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

4 REPLIES 4
Ashwin_Wadalkar
Frequent Visitor

Please guide me on which function i can use for ;

- And (viz....code "100495" And " 100395" And " 100503")

- OR   (viz....either code "100495" or " 100395" or " 100503")

 

Thanks

 

@Ashwin_Wadalkar 
not sure if I understand - but for And, use AND function:
https://docs.microsoft.com/en-us/dax/and-function-dax (or you can use operator &&)
for Or function use OR:
https://docs.microsoft.com/en-us/dax/or-function-dax



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on LinkedIn!

Fowmy
Super User
Super User

@Ashwin_Wadalkar 

Use it this way:

Sales = 
CALCULATE(
    [Sales Amt],
    Sheet1[Material Code] IN {"100495","100395","100503"}
)
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Migasuke
Super User
Super User

Hi,

Have you tried OR operator ||?
Try:
Sales = Calculate CALCULATE(([Sales Amt],(Sheet1[Material Code]="100495" || Sheet1[Material Code]= "100395" || Sheet1[Material Code]= "100503")



If my answer was helpful please give me a Kudos or even accept as a Solution.

Let's connect on 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.

Top Solution Authors
Top Kudoed Authors