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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Imrans123
Advocate V
Advocate V

Finding details of a followup (DAX Measure help needed)

Hey all, 

 

Was wondering if anyone could help me out. I have written a DAX Formula which shows me if there is a followup booked which is calculated as follows, 

 

IF (
NOT ( ISBLANK ( [AppointmentCount] ) ),
VAR MaxDate =
MAX (Appointment[AppointmentDate] ) 
RETURN
CALCULATE (
MIN (Appointment[AppointmentDate] ),
ALL (Appointment), 
SUMMARIZE (Appointment, Appointment[Patient ID] ), 
Appointment[Date] > MaxDate, 
Appointment[IsBooked]=TRUE()
)
)

 

In addition to this, I have another measure which returns to me, the name of the provider with whom the follow up is booked with

 

 

IF (
    NOT ( ISBLANK ( [AppointmentCount] ) ),
    VAR MaxDate =
        MAX ( Appointment[AppointmentDate] ) 
    RETURN
        CALCULATE (
            FIRSTNONBLANK(Appointment[Psychologist],1),
            ALL ( Appointment ), 
            SUMMARIZE ( Appointment, Appointment[Patient ID] ), 
            Appointment[AppointmentDate] > MaxDate, 
            Appointment[IsBooked]=TRUE()
        )
)

 

The issue is that the first measure works exactly as it should. However, the second measure sometimes give inconsistent results. Any idea about how this can be addressed?

 

Since the first measure works perfectly, Is there a way for me to use teh first measure and then return the respective value for a given column like Psychologist from there? 

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Imrans123 

Since your first formula has calculated the corresponding Appointment[Date], then you can use it to replace your ‘MaxDate’ in the second formula as a filter condition .

Please modify your second formula as below:

 

Your Second Measure=
IF (
    NOT ( ISBLANK ( [AppointmentCount] ) ),
    VAR MaxDate =
        [Your first measure name]
    RETURN
        CALCULATE (
            FIRSTNONBLANK(Appointment[Psychologist],1),
            ALL ( Appointment ), 
            SUMMARIZE ( Appointment, Appointment[Patient ID] ), 
            Appointment[AppointmentDate] = MaxDate, 
            Appointment[IsBooked]=TRUE()
        )
)

 

 

Best Regards,
Community Support Team _ Eason

Ashish_Mathur
Super User
Super User

Hi,

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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