cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helpful_Fun4848
Helper II
Helper II

Condition overwriting the other conditions

Hi all,

I'm trying to get the total with the following conditions:

1. IsNet = True

2. SupplierCode = only selected code (say 1102 and 1103)

3. Specifically just for CompanyCode 6601, I would like to get the total even though IsNet is False (selected supplier code still applies)

 

Not sure what's the best approach. I tried to create custom column with IF statement creating True/False but, I can't get all the conditions. 

 

This is what the data looks like:

 

Company CodeIsNetSupplierCodeTotal
6601True/False1101 
6602 1102 
6603 1103 
6604 1104 

 

Any help would be appreciated!!

1 ACCEPTED SOLUTION

@Helpful_Fun4848 

Create the following measure:

Total Measure = 

CALCULATE(
    SUM(Table2[Total]),
    Table2[IsNet] = TRUE()
)
+
CALCULATE(
    SUM(Table2[Total]),
    Table2[Company Code] = 6601
)
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

6 REPLIES 6
Fowmy
Super User
Super User

@Helpful_Fun4848 

Do you need a measure that gives you the total based on your conditions? IF so, which column should I sum?
For the SupplierCode, hope you will have a slicer in the report.

Please explain

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

@Fowmy 

Yes, I need the sum of Total column based on the conditions.  

 

As for slicer, does filter for suppliercode works as well? Or, does it have to be a slicer?

@Helpful_Fun4848 

Create the following measure:

Total Measure = 

CALCULATE(
    SUM(Table2[Total]),
    Table2[IsNet] = TRUE()
)
+
CALCULATE(
    SUM(Table2[Total]),
    Table2[Company Code] = 6601
)
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

@Fowmy 

 

It looks like it works but I need to double check the result. 

Also, want to double check the following. I need to create another measure where the condition is the opposite of the measure that you created. This time, I do not want to include company code 6601 and IsNet = false. 

 

Does the following measure correct?

 

CALCULATE(
SUM(Table2[Total]),
Table2[IsNET] = FALSE()
)
+
CALCULATE(
SUM(Table2[Total]),
Table2[Company Code] <> 6601
)

 

@Helpful_Fun4848 

Yes, it should work, test and update please.

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

@Fowmy 

 

I believe it works, thx!

Helpful resources

Announcements
PBI_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!