cancel
Showing results for
Did you mean:

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

Helper III

## Need a Measure Which Counts Number of Distinct Items Whose Earliest Date Is Classified by a SubType

Hi!

I have a table which tracks Bookings made by an ID, the dates on which they contact us, and the Medium (Inquiry Source) by which they contact us.

I would like to know how many distinct bookings used each type for their first inquiry. The left is a small sample set and the right is the desired result. 3 bookings had the phone as their first (earliest) contact method, 1 had email, 1 had the internet.

Many thanks for any help!

3 REPLIES 3
Helper III

Hi! Thank you for the quick and thorough reply. I'm doing well, I think, until I get here:

Sum Last Qty = Countx(VALUES(Data1[BookingID]) , [BookingID])

Is that written correctly? I'm not picking up a match on it. Thank you.

Super User

@apmulhearn , Try a measure like

Measure = Var _max = Minx(filter( ALLSELECTED(Data1), Data1[BookingID] = max(Data1[BookingID]) ),Data1[InqueryDate])
return
CALCULATE(Min(Data1[InquerySource]), filter( (Data1), Data1[BookingID] = max(Data1[BookingID]) && Data1[InqueryDate] =_max))

Sum Last Qty = Countx(VALUES(Data1[BookingID]) , [BookingID])

Helper III

Thank you, @amitchandak . I think I'm misunderstanding part of this. The blue highlighted part isn't seeming to work for me. Is that supposed to be part of the same measure? The first portion is working well for me, but I receive errors as soon as I get to the blue part, and I can't figure out what to do with it.

Measure = Var _max = Minx(filter( ALLSELECTED(Data1), Data1[BookingID] = max(Data1[BookingID]) ),Data1[InqueryDate])
return
CALCULATE(Min(Data1[InquerySource]), filter( (Data1), Data1[BookingID] = max(Data1[BookingID]) && Data1[InqueryDate] =_max))

Sum Last Qty = Countx(VALUES(Data1[BookingID]) , [BookingID])

Announcements

#### New forum boards available in Real-Time Intelligence.

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

#### Power BI Monthly Update - May 2024

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

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors