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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
PMeadows
Frequent Visitor

Only have dynamic MIN and MAX date datapoints on line chart

Hello,

I have a problem where I am trying to only show the MIN and MAX date points on a line chart. The MAX date will dynamically change with a slicer from another column so I can't use a static RANX on a calculated column.

Here's a visual of my problem.

PMeadows_0-1711063681070.png

 

 

As you can see there are loads of 0 values. I am looking to get a straight line from the first point to a dynamic last point based on a slicer.

Does anyone have any thoughts on how to do this with measures?

Thanks a lot,
Pete


 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @PMeadows ,

Please create a new measure like:

Measure = 
VAR __first_noblank_date = CALCULATE(FIRSTNONBLANK('Date'[Date],[YourMeasureName]),ALLEXCEPT('Table','Table'[Legend Field]))
VAR __last_noblank_date = CALCULATE(LASTNONBLANK('Date'[Date],[YourMeasureName]),ALLEXCEPT('Table','Table'[Legend Field]))
VAR __first_noblank_value = CALCULATE([YourMeasureName],'Date'[Date]=__first_noblank_date)
VAR __last_noblank_value = CALCULATE([YourMeasureName],'Date'[Date]=__last_noblank_date)
VAR __result = SWITCH(SELECTEDVALUE('Date'[Date]),__first_noblank_date,__first_noblank_value,__last_noblank_date,__last_noblank_value)
RETURN
__result

output:

vcgaomsft_0-1711073166734.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly--How to provide sample data in the Power BI Forum--China Power BI User Group

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @PMeadows ,

Please create a new measure like:

Measure = 
VAR __first_noblank_date = CALCULATE(FIRSTNONBLANK('Date'[Date],[YourMeasureName]),ALLEXCEPT('Table','Table'[Legend Field]))
VAR __last_noblank_date = CALCULATE(LASTNONBLANK('Date'[Date],[YourMeasureName]),ALLEXCEPT('Table','Table'[Legend Field]))
VAR __first_noblank_value = CALCULATE([YourMeasureName],'Date'[Date]=__first_noblank_date)
VAR __last_noblank_value = CALCULATE([YourMeasureName],'Date'[Date]=__last_noblank_date)
VAR __result = SWITCH(SELECTEDVALUE('Date'[Date]),__first_noblank_date,__first_noblank_value,__last_noblank_date,__last_noblank_value)
RETURN
__result

output:

vcgaomsft_0-1711073166734.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly--How to provide sample data in the Power BI Forum--China Power BI User Group

Thanks so much!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors