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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
tmac1954
Frequent Visitor

DAX for Value Dependent on Another Column (distinctcount)

Hello, I appreciate any help for creating a measure for the following.  There may be multipe row entries for one accident #.

Thank you.

Result should be:
23 incidents
21 reported
2 unreported
Accident #Reported / Unreported
2023-001Reported
 Reported
2023-002Reported
 Reported
2023-003Reported
2023-004Reported
 Reported
2023-005Reported
 Reported
2023-006Reported
 Reported
2023-007Reported
2023-009Reported
 Reported
2023-013Reported
 Reported
2023-014Reported
 Reported
2023-015Reported
 Reported
2023-016Unreported
 Unreported
2023-017Reported
 Reported
2023-018Reported
2023-020Reported
 Reported
2023-025Reported
2023-026Unreported
 Unreported
 Unreported
2023-029Reported
 Reported
 Reported
 Reported
2023-046Reported
 Reported
2023-047Reported
 Reported
2023-068Reported
 Reported
2023-073Reported
2023-083Reported
 Reported
2 ACCEPTED SOLUTIONS

hi, @tmac1954 

 

my above code only work without filling data 

because i ignore blank value in measure.

 

so try below code it help you 

it's  all  measure

 

incidents = 
DISTINCTCOUNT(accident[Accident #])

reported = 
CALCULATE(
     DISTINCTCOUNT(accident[Accident #]),
       accident[Reported / Unreported]="reported"
          )

unreported = 
CALCULATE(
      DISTINCTCOUNT(accident[Accident #]),
        accident[Reported / Unreported]="unreported"
          )

 

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. and don't forget to give kudos.

View solution in original post

Works like a charm!! I appreciate you taking your time, offering a solution and replying.

Thank you!

 

View solution in original post

9 REPLIES 9
FreemanZ
Community Champion
Community Champion

You need firstly fill down the Accident # column in Power Query:

https://learn.microsoft.com/en-us/power-query/fill-values-column

 

then everything becomes apparent.

I had done the fill in the power query, sorry I didn't share that portion.

then try to plot a table visual with Reported / Unreported column and a measure like:

measure = DISTINCTCOUNT(tablename[Accident #])

Dangar332
Resident Rockstar
Resident Rockstar

hi, @tmac1954 

try below three measure 

 

incidents = COUNTX(
              FILTER(accident,
                accident[Accident #]<>BLANK()),
                accident[Accident #]
                   )

reported = 
COUNTX(
    FILTER(accident,
         accident[Accident #]<>BLANK()&& accident[Reported / Unreported]="reported"
           )
          ,accident[Accident #]
            )

unreported = 
COUNTX(
     FILTER(accident,
          accident[Accident #]<>BLANK()&& accident[Reported / Unreported]="unreported"
           ) 
       ,accident[Accident #]
       )

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. and don't forget to give kudos.

 

Thank you for the suggestions and examples.  I'm still receiving the incorrect values.  I used the "fill down" in the accident #'s in my power query and counting the disctinctcount for total accidents.  The issue is there is multiple row entries for accidents showing reported or unreported and it's counting one accident reported/unreported multipe times.  

I believe I'm not understanding the logic, sorry..  I appreciate your help very much!!  

I am still learning.

tmac1954_0-1698330378186.png

 

 

Reported =
COUNTX(
    FILTER(Accidents,
         [Accident #]<>BLANK()&& Accidents [Reported / Unreported]="reported"
           )
          ,Accidents[Accident #]
            )
 
Unreported =
COUNTX(
    FILTER(Accidents,
         [Accident #]<>BLANK()&& Accidents [Reported / Unreported]="unreported"
           )
          ,Accidents[Accident #]
            )

hi, @tmac1954 

 

my above code only work without filling data 

because i ignore blank value in measure.

 

so try below code it help you 

it's  all  measure

 

incidents = 
DISTINCTCOUNT(accident[Accident #])

reported = 
CALCULATE(
     DISTINCTCOUNT(accident[Accident #]),
       accident[Reported / Unreported]="reported"
          )

unreported = 
CALCULATE(
      DISTINCTCOUNT(accident[Accident #]),
        accident[Reported / Unreported]="unreported"
          )

 

 

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. and don't forget to give kudos.

Works like a charm!! I appreciate you taking your time, offering a solution and replying.

Thank you!

 

Dangar332
Resident Rockstar
Resident Rockstar

hi, @tmac1954 

you want it in measure or table?

I was thinking a measure but either if it works.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.