The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hi,
I am trying to create a chart that will show the min/max stock prices for a given date range as well as a point for the most recent stock price. Sort of like a gauge chart. Ideally the range would be represented by a horizontal line with each end representing the min and max values. And the most current price would be a point on that line to show how close/far the current price is to its historical max/min. Thank you!!
Solved! Go to Solution.
Hi @DennisReynolds ,
Please refer to my pbix file to see if it helps you.
Create a measure.
Measure = var _max=MAXX(ALLSELECTED('Table'[date]),'Table'[date])
var _min=MINX(ALLSELECTED('Table'[date]),'Table'[date])
var _maxvalue=CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[date]<=_max&&'Table'[date]>=_min))
var _minvalue=CALCULATE(min('Table'[value]),FILTER(ALL('Table'),'Table'[date]<=_max&&'Table'[date]>=_min))
var _newest=CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[date]=_max))
return
IF(MAX('Table'[value])=_maxvalue,MAX('Table'[value]),IF(MAX('Table'[value])=_minvalue,MAX('Table'[value]),IF(MAX('Table'[value])=_newest,MAX('Table'[value]),BLANK())))
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
Share some data (in a format that can be pasted in an MS Excel file) and show the expected result. If you are selecting a date range, then what do you mean by "most current price"?
Hi @DennisReynolds ,
Please refer to my pbix file to see if it helps you.
Create a measure.
Measure = var _max=MAXX(ALLSELECTED('Table'[date]),'Table'[date])
var _min=MINX(ALLSELECTED('Table'[date]),'Table'[date])
var _maxvalue=CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[date]<=_max&&'Table'[date]>=_min))
var _minvalue=CALCULATE(min('Table'[value]),FILTER(ALL('Table'),'Table'[date]<=_max&&'Table'[date]>=_min))
var _newest=CALCULATE(MAX('Table'[value]),FILTER(ALL('Table'),'Table'[date]=_max))
return
IF(MAX('Table'[value])=_maxvalue,MAX('Table'[value]),IF(MAX('Table'[value])=_minvalue,MAX('Table'[value]),IF(MAX('Table'[value])=_newest,MAX('Table'[value]),BLANK())))
If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .
Best Regards
Community Support Team _ Polly
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.