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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
funsznanalytics
Frequent Visitor

Dynamic Min and Max Date Field Based on Values From Slicer Selection

I am trying to get the first score, and the last score based on the dates selected in slicer. I created a date table with DAX and joined to this table one to many, then created a measure to get the min and max date from ALLSELECTED (using between dates slicer). But when I try to use those fields as variables in a dax measure, I am getting errors such as only expecting one value. My end goal is to get the average of the first scores and last scores per wound to see if they have improved or not. This would be a great start, thanks

 

-----------------------TABLE: If Slicer selection dates between 1/5/2020 and 1/23/2020
 
model.PNG

 

---------------DAX MEASURE SO FAR:

 

Last Visit Date =
 
VAR patient = 'Query1'[PatientID]
VAR wound = 'Query1'[WoundSite]
VAR startdate = [Start Date Measure]
VAR enddate = [End Date Measure]

RETURN
MAXX( FILTER(
    ALL('Query1'),'Query1'[PatientID] = patient
          && 'Query1'[WoundSite] = wound
          && Query1[VisitDate] <= enddate
          && Query1[VisitDate] >= startdate
 
   ),Query1[VisitDate])
 
2 REPLIES 2
AlB
Community Champion
Community Champion

Hi @funsznanalytics 

Can you provide an example based on the dat you show wit the expected result?

Where/how would you want to use that measure?

The relationship is between which cilumns exactly??

Please mark the question solved when done and consider giving a thumbs up if posts are helpful.

Contact me privately for support with any larger-scale BI needs, tutoring, etc.

Cheers 

SU18_powerbi_badge

 

I am joining Dates[Date] to Query1[DOS]   --(Date of Service)

I would be using the measures in cards and pivot them to put on bar chart as a single value, always the average of total. Just need the inital and final scores never aggregated

 

funsznanalytics_0-1608033340133.png

 

 

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.