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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Auski
Advocate I
Advocate I

DAX Measure addition/change help needed

Good afternoon all,

 

I have the following measure to return the latest task/appointment date, which works brilliantly. 

 

Appointment (ALL) Most Recent =
VAR appttaskdate =
    CALCULATE (
        MAX ( Task[Created_Date] ),
        FILTER ( Task, Task[Created_Date] < TODAY () ),
        Task[task_record_type] <> "System Generated Task"
    )
VAR apptdate =
    CALCULATE (
        MAX ( Appointments[appointment_date] ),
        FILTER ( Appointments, Appointments[appointment_date] < TODAY () ),
        Appointments[status] = "Completed"
    )
RETURN
    IF ( apptdate > appttaskdate, apptdate, appttaskdate )

 

 

Based of this measure, I now also need to return Task[task_record_type]. Any ideas how I might do this? Would a second measure be best, or modify this measure?

https://drive.google.com/file/d/1poBCfP3UPDIl7tDuTjHdfsBuyqT2cEwA/view?usp=sharing

Thanks so much,

 

 
1 ACCEPTED SOLUTION

PBI file attached.  Those images are very small so i can barely read anything.

Ashish_Mathur_0-1707983001941.png

 


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

View solution in original post

7 REPLIES 7
Auski
Advocate I
Advocate I

@amitchandak Thanks for your time with this. I think you are close, however I neglected to mention there is Task[task_record_type] and also Appointment[Record Type] to consider.

Appointment (ALL) Most Recent =
VAR appttaskdate =
    CALCULATE (
        MAX ( Task[Created_Date] ),
        FILTER ( TaskTask[Created_Date] < TODAY () ),
        Task[task_record_type] <> "System Generated Task"
    )
VAR apptdate =
    CALCULATE (
        MAX ( Appointments[appointment_date] ),
        FILTER ( AppointmentsAppointments[appointment_date] < TODAY () ),
        Appointments[status] = "Completed"
    )
RETURN
    IF ( apptdate > appttaskdate, Task[task_record_type], Appointment[Record Type] )



Hope that makes sense. 

I have shared on my google drive.
https://drive.google.com/file/d/1poBCfP3UPDIl7tDuTjHdfsBuyqT2cEwA/view?usp=sharing 

Thanks!!

There's a lot of data there which in turn is causing confusion.  Could you share a smaller dataset and show the expected result.


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

@Ashish_Mathur Thanks for your reply. I have updated the data set and included expect result as requested. Hope this helps! 

https://drive.google.com/file/d/1poBCfP3UPDIl7tDuTjHdfsBuyqT2cEwA/view?usp=drive_link

PBI file attached.  Those images are very small so i can barely read anything.

Ashish_Mathur_0-1707983001941.png

 


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

@Ashish_Mathur  Thank you for your time with this Ashish - you're a genius!

You are welcome.  Thank you for your kind words.


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

@Auski , Try like

 

CALCULATE (
Lastnonblankvalue ( Task[Created_Date], max(Task[task_record_type] )),
FILTER ( Task, Task[Created_Date] < TODAY () ),
Task[task_record_type] <> "System Generated Task"
)

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.