Forum Discussion

Harry1980's avatar
Harry1980
Helper I
3 years ago
Solved

Distinct search/lookup

Hi all,   I have a little challenge where I struggle with and hope to find help here in this great community. What is the challenge?  For a certain material I need to search for the standard price ...
  • FreemanZ's avatar
    3 years ago

    hi Harry1980 

    try to plot a table with the material column and a measure like this:

    Standard Price = 
    VAR _targetmonth = 9
    VAR _targetyear =2021   // the first two lines could be replaced other ways
    VAR _material = MAX(TableName[Material])
    VAR _table =     
    FILTER(
            TableName, 
            TableName[Material]=_material
                &&TableName[Year] = _targetyear
                &&TableName[Pe] <= _targetmonth
        )
    
    VAR _month = 
    MAXX(
        _table,
        TableName[Pe]
    )
    RETURN 
    MAXX(
        FILTER(_table, TableName[Pe]=_month),
        TableName[ Standard price ]
    )

     

    i tried and it worked like this: