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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
SGiambrone
Frequent Visitor

Latest Value Based on Multiple Criteria (Name, Date, Activity)

Hello,

I am trying to create a single measure which I can apply visual filters to to show the below data. Patients are recording 4 metrics on a daily basis: weight, pulse ox, blood pressure, and temperature. For this patient dashboard, we want to show the most current reading of each metric. What is making this tricky for me is that not every patient will always submit all 4 metrics on the same day, but I want the measure to display whatever the most current reading is for each one (could be from different dates).

 

My efforts so far have landed me below:

SGiambrone_0-1594911829764.png

I would want the weight to display the metric input from 6/9. Also, this patient did not submit EITHER of the blood pressure metrics, yet one is displaying accurately per his latest reading, the other N/A. 

 

The data is structured as such, where the value represents the reading.

SGiambrone_1-1594911946091.png

 

My current measure is not working.

CALCULATE(
SUM(
HealthActionDataSample[Value]
),
FILTER(
HealthActionDataSample,
HealthActionDataSample[Date Completed]=MAX(HealthActionDataSample[Date Completed])
)
)

 

Any ideas how to beef this up?

Thanks!

1 ACCEPTED SOLUTION
v-yiruan-msft
Community Support
Community Support

Hi @SGiambrone ,

You can create a measure as below to get the recent value for per health action type. I created a sample pbix file for you, you can get it from this link. Actually, I create two measures to get the values. Please check which one is what you exactly need.

Latest value =
VAR _patientid =
    MAX ( 'HealthActionDataSample'[Patient ID] )
VAR _healthaction =
    MAX ( 'HealthActionDataSample'[Health Action] )
VAR _curdate =
    MAX ( HealthActionDataSample[Date Completed] )
RETURN
    CALCULATE (
        MAX ( HealthActionDataSample[Value] ),
        FILTER (
            HealthActionDataSample,
            'HealthActionDataSample'[Patient ID] = _patientid
                && 'HealthActionDataSample'[Health Action] = _healthaction
                && HealthActionDataSample[Date Completed] = _curdate
        )
    )

Latest Value Based on Multiple Criteria (Name, Date, Activity).JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yiruan-msft
Community Support
Community Support

Hi @SGiambrone ,

You can create a measure as below to get the recent value for per health action type. I created a sample pbix file for you, you can get it from this link. Actually, I create two measures to get the values. Please check which one is what you exactly need.

Latest value =
VAR _patientid =
    MAX ( 'HealthActionDataSample'[Patient ID] )
VAR _healthaction =
    MAX ( 'HealthActionDataSample'[Health Action] )
VAR _curdate =
    MAX ( HealthActionDataSample[Date Completed] )
RETURN
    CALCULATE (
        MAX ( HealthActionDataSample[Value] ),
        FILTER (
            HealthActionDataSample,
            'HealthActionDataSample'[Patient ID] = _patientid
                && 'HealthActionDataSample'[Health Action] = _healthaction
                && HealthActionDataSample[Date Completed] = _curdate
        )
    )

Latest Value Based on Multiple Criteria (Name, Date, Activity).JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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