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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
maddogp
Frequent Visitor

Understanding a DAX Measure

Hi
I'm hoping someone can assist with understanding a DAX measure. 

I've inherited a report that includes a measure  which excludes data from a matrix column if the SchoolYear is 20222023 AND the course is MFM.  See table below.  Note, the underlying data has values for MFM in 20222023.

 

maddogp_0-1687533586631.png

I'm trying to understand HOW and WHY this measure works to give this result?  

measure =
CALCULATE(
    counta(Studentachievement[Mark]),
filter(Course, Course[CourseCode] <> "MFM" ||
countrows(filter(Studentachievement, Studentachievement[SchoolYear] in {"20222023"}))=0
)
)

Without the OR condition of the FILTER , 

||
countrows(filter(Student, Student[SchoolYear] in {"20222023"}))=0
)
no data will show in the MFM column, and as mentioned, there is underlying data for MFM in 20222023.
How does this second part work to produce the desired result?
Thanks in advance.
1 ACCEPTED SOLUTION
cassidy
Impactful Individual
Impactful Individual

I'm pretty sure this is right:

 

For OR, if one of the two is TRUE, it's TRUE, if both are FALSE, it's FALSE

 

The 2nd part of the OR, if you were to put it as it's own Measure, returns this:

 

cassidy_0-1687537189365.png

So for 20222023 MFM, you get a FALSE || FALSE = Don't count it

For 20222023 MPM, you get a TRUE || FALSE = Do count it

 

All other combo's have a TRUE in them somewhere and get Counted

 

I'm sure there are other ways to write it that make more sense, but it's interesting

View solution in original post

2 REPLIES 2
cassidy
Impactful Individual
Impactful Individual

I'm pretty sure this is right:

 

For OR, if one of the two is TRUE, it's TRUE, if both are FALSE, it's FALSE

 

The 2nd part of the OR, if you were to put it as it's own Measure, returns this:

 

cassidy_0-1687537189365.png

So for 20222023 MFM, you get a FALSE || FALSE = Don't count it

For 20222023 MPM, you get a TRUE || FALSE = Do count it

 

All other combo's have a TRUE in them somewhere and get Counted

 

I'm sure there are other ways to write it that make more sense, but it's interesting

That makes sense.
Thanks so much!!!!!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.