Forum Discussion

vsslasd1's avatar
vsslasd1
Icon for Helper III rankHelper III
5 years ago
Solved

Dax New Table Query Get the Minimum Value from a column

I am trying to return only one value: The minimum value of a table, using the following syntax: This is is the code that I need/want to use, but it returns the entire table for the column. I want t...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi vsslasd1 

    Your requirement is to return the Min Period from a filtered table. What is the data type of your Period column, text or date type? I see you use DATEVALUE function in your first dax code. DATEVALUE function is to convert text type value to date type. So I think your Period value's format looks like "2021/01/01".

    What does "Current" mean in your filter ('WIP-ALL'[Period]<>"Current") ? If "Current" is the date value of today, you can use Today() function.

    Sample:

    You can build a measure to get the min period.

    Measure = MINX(FILTER(ALL('WIP-ALL'),'WIP-ALL'[PERIOD]<>TODAY()),'WIP-ALL'[PERIOD])

    Result:

    If you want to build a calcualted column, you can try this code.

    Column = CALCULATE(MIN('WIP-ALL'[PERIOD]),FILTER('WIP-ALL','WIP-ALL'[PERIOD]<>TODAY()))

    Result:

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.