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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SBR1D
Helper III
Helper III

CALCULATETABLE with one AND condition and one OR condition

Hi

 

I am trying to make a calculate table with the conditions showing in the code. Problem is if i filter the table to FALSE() i get all of the possible reasons but i only want rows with the reason set in the code.

 

Where am i going wrong please?

 

 test table v2 = 
 
 CALCULATETABLE('Activity',

    OR(
    'Activity'[Off The Job Hours Approved] = FALSE() && 'Activity'[Rejection Reason] = "Is English or Maths",
    'Activity'[Off The Job Hours Approved] = TRUE() ||   'Activity'[Off The Job Hours Approved] = BLANK())
    
   )

 

1 ACCEPTED SOLUTION

Hi @SBR1D ,

 

Try the following code:

 

CALCULATETABLE(
		'Activity OTJ',
			'Activity OTJ'[Off The Job Hours Approved] = TRUE() || 'Activity OTJ'[Off the Job Hours Approved] == BLANK() ||
			('Activity OTJ'[Off The Job Hours Approved] = FALSE() && 'Activity OTJ'[Rejection Reason] = "Is English or Maths")
		)
	

 

The major change for your code is the parenthisis on the second part of the code where you use the and condition and the == blank() that forces the results to be exactly blank.

 

I have removed the filter part because the calculatetable syntax does the exact same thing in terms of the filter option in this case.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

8 REPLIES 8
SBR1D
Helper III
Helper III

Hi

 

So i have played around with the dax code and doing the following works for if the Hours approved column is True/False where rejection reason is "Is English or Maths".

 CALCULATETABLE ( 'Activity OTJ', 

 FILTER('Activity OTJ' ,
 'Activity OTJ'[Off The Job Hours Approved] = TRUE()   ||
 'Activity OTJ'[Off The Job Hours Approved] = FALSE() && 'Activity OTJ'[Rejection Reason] = "Is English or Maths"))
 

 

Problem is if i add in a 3rd condition as shown below , approved hours to False no longer works and shows all reasons.

 

 CALCULATETABLE ( 'Activity OTJ', 

 FILTER('Activity OTJ' ,
 'Activity OTJ'[Off The Job Hours Approved] = TRUE()   ||  'Activity OTJ'[Off The Job Hours Approved] = BLANK()  ||
 'Activity OTJ'[Off The Job Hours Approved] = FALSE() && 'Activity OTJ'[Rejection Reason] = "Is English or Maths"))
 

 

Hi @SBR1D ,

 

Try the following code:

 

CALCULATETABLE(
		'Activity OTJ',
			'Activity OTJ'[Off The Job Hours Approved] = TRUE() || 'Activity OTJ'[Off the Job Hours Approved] == BLANK() ||
			('Activity OTJ'[Off The Job Hours Approved] = FALSE() && 'Activity OTJ'[Rejection Reason] = "Is English or Maths")
		)
	

 

The major change for your code is the parenthisis on the second part of the code where you use the and condition and the == blank() that forces the results to be exactly blank.

 

I have removed the filter part because the calculatetable syntax does the exact same thing in terms of the filter option in this case.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



MFelix
Super User
Super User

Hi @SBR1D

 

Try the following code:

 

test table v2 =
CALCULATETABLE (
    'Activity',
    (
        'Activity'[Off The Job Hours Approved] = FALSE ()
            && 'Activity'[Rejection Reason] = "Is English or Maths"
    )
        || (
            'Activity'[Off The Job Hours Approved] = TRUE ()
                || 'Activity'[Off The Job Hours Approved] = BLANK ()
        )
)

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi

 

Thanks for the code but i tried it and it doesn't work. If i filter Hours Approved to False i still to see all Rejection reasons

 

When i filter the Hours Approved column to "False" i only see blanks in the cells but if i filter to "True" i can see the True values in the cells which is odd.

What is your expected outcome?  Your boolean logic can be simplified.

 

 CALCULATETABLE('Activity',

    'Activity'[Off The Job Hours Approved] <> FALSE() || 'Activity'[Rejection Reason] = "Is English or Maths"   )

 

hello , logic is as follows

 

if off the job hours approved is FALSE then filter the Rejection reason column to 

"Is English or Maths"

and include the following  -  off the job hours approved = TRUE AND  off the job hours approved = BLANK()

Anonymous
Not applicable

Hi @SBR1D ,

It's been a while since I heard back from you and I wanted to follow up. Have you had a chance to try the solutions that have been offered? If the issue has been resolved, can you mark the post as resolved? If you're still experiencing challenges, please feel free to let us know and we'll be happy to continue to help!
Looking forward to your reply!

Hello, no i have had a solution yet. I posted on 12-24-2024 01:33  clarifying the issue.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.