Forum Discussion

Vevu's avatar
Vevu
New Member
4 years ago
Solved

How to get MAX value from GENERATESERIES function with FILTER?

Hi all,

 

I am new in Power BI and I have a question regarding using a variable table in a calculated column. I have a table, andI'd like to make a calculated column. 
It will evaluate each row, create a generateseries virtual table, and find the max value from the virtual table that is still less than the value of the row, and return it as the value of the calculated table.

I tried illustrating what I want below. For example for row 5 with value 3.2, it will return 3 in the calculated column BIN. Because the max value from the generateseries that is still less or equal than 3.2 is 3.

This is the code that I tried but it doesn't work (obviously). How can I make this work? 


Thank you in advance.

  • Oh nevermind I found out how! 
    It should be:

    calculatedcolumn = 
    var _series = generateseries([mindata],[maxdata],[binsize])
    var _bin = MAXX(FILTER(_series, [Value] <= [row_value]), [Value])
    return
    _bin

    Thank you!

1 Reply

  • Vevu's avatar
    Vevu
    New Member

    Oh nevermind I found out how! 
    It should be:

    calculatedcolumn = 
    var _series = generateseries([mindata],[maxdata],[binsize])
    var _bin = MAXX(FILTER(_series, [Value] <= [row_value]), [Value])
    return
    _bin

    Thank you!