Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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.
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
Solved! Go to Solution.
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:
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
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:
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!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!