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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

Different DAX same answer

Hi guys,

 

I am still figuring out how to use DAX. I have come up with the same answer using what looks like different DAX.  

 

Is one better than the other or are they both essentially the same? I think the latter might be more efficent as it only filters a column. And what about OR and II, do these mean the same thing?

 

1.

=CALCULATE (
[TotalHours],
FILTER (
EmployeeHours,
EmployeeHours[Code] = "PICK"
|| EmployeeHours[Code] = "AXE"
)
)

 

2. 

=CALCULATE (
[TotalHours],
FILTER (
ALL ( EmployeeHours[Code] ),
OR (
EmployeeHours[Code] = "PICK",
EmployeeHours[Code] = "AXE"
)
)
)

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous yes || and OR are doing the same thing here.  One is a Function and another one is an operator .

 

In this case, you can use in

CALCULATE (
[TotalHours],
FILTER (
EmployeeHours,
EmployeeHours[Code] in { "PICK" , "AXE" }
)
)

 

I try to avoid or as far as possible

 

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous yes || and OR are doing the same thing here.  One is a Function and another one is an operator .

 

In this case, you can use in

CALCULATE (
[TotalHours],
FILTER (
EmployeeHours,
EmployeeHours[Code] in { "PICK" , "AXE" }
)
)

 

I try to avoid or as far as possible

 

Anonymous
Not applicable

@amitchandak  Thanks for that...Although now there is a third way to do this calculation 😄

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors