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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

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
OCT PBI Update Carousel

Power BI Monthly Update - October 2024

Check out the October 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors