Forum Discussion
Max & Min Dates Only Filter (top1/bottom1)
- 7 years ago
Hi SiroPW ,
The formula in your measure is missing another condition:
Return IF(MAX('Table'[Date])=maxd||MAX('Table'[Date])=mind,"Yes","No")I attached my pbix here for your reference, also please share yours if you are still stuck in it.
Thanks for the reply.
Do you know how I could modify this to work with only the filtered/selected values?
I tried ALLSELECTED like below but I'm getting an error "The MAX function only accepts a column reference as an argument".
-- first get the max date as a veriable
Hi SiroPW ,
You can take try of this one:
MAX&MIN = var maxd = MAXX(ALLSELECTED('Table'),[Date])
var mind = MINX(ALLSELECTED('Table'),[Date])
Return IF(MAX('Table'[Date])=maxd||MAX('Table'[Date])=mind,1,0)
When the date were filtered, it still works:
- SiroPW7 years ago
Helper I
Thanks, I've tried a lot of combinations/tweaks of your answer but I still can't quite get it to filter properly.
It basically ends up returning True/1 for every record.
My latest attempt was to strip it back:
MAX&MIN =var maxd = MAXX(ALLSELECTED(portfolio_eom),[as_at_date])var mind = MINX(ALLSELECTED(portfolio_eom),[as_at_date])Return IF(MAX(portfolio_eom[as_at_date])=maxd,"Yes","No")I can see the maxd is returning the correct date and MAX(portfolio_valuation_eom[as_at_date]) by itself is too (they match), however every record returns "Yes".Any ideas why? I feel like it should be something simple I'm missing. Thanks- SiroPW7 years ago
Helper I
I think the problem is the ALLSELECTED is not working my my Date slicer.
- v-diye-msft7 years ago
Community Support
Hi SiroPW ,
The formula in your measure is missing another condition:
Return IF(MAX('Table'[Date])=maxd||MAX('Table'[Date])=mind,"Yes","No")I attached my pbix here for your reference, also please share yours if you are still stuck in it.