Forum Discussion
Return min value
Hi there, I have a question on return min value. Below is a sample data set.
Under Company column, the last two rows are blank.
I would like to have a measure to return the company name with a minimum price. However, when Company name = null, the corresponding price value should not be included. In this case, 0 would not be considered.
Also, price can be duplicate. So I'd like to return either the first company value or the last company value unless there is a better way to handle this.
Here is my measure but doesn't work:
Anonymous , Try like
MINSUB =
VAR min_pice =CALCULATE(MIN(Table[PRICE]),filter(Table, Table[Company] <> "" && not(isblank(Table[Company]))))VAR min_sub =
calculate(min(TABLE[COMPANY]),FILTER(Table,price = min_pice && Table[Company] <> "" && not(isblank(Table[Company]))))
return min_sub
2 Replies
- amitchandakSuper User
Anonymous , Try like
MINSUB =
VAR min_pice =CALCULATE(MIN(Table[PRICE]),filter(Table, Table[Company] <> "" && not(isblank(Table[Company]))))VAR min_sub =
calculate(min(TABLE[COMPANY]),FILTER(Table,price = min_pice && Table[Company] <> "" && not(isblank(Table[Company]))))
return min_sub- AnonymousNot applicable
Thank you so much. It worked!
I'm just trying to understand it. Because it is a measure, so that it will return an aggregated value, and that's why we can use min on a text column?
also, what's the meaning of not(isblank(Table[Company]) for both variable? I thought Table[Company] <> "" handles the blank fields but seems it does not?
Again thank you very much for your quick answer. amitchandak