cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.

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?
1 ACCEPTED SOLUTION
Power Participant

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:

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

2 REPLIES 2
Power Participant

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:

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

Frequent Visitor

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

Announcements

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

Power BI Monthly Update - April 2024

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

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors