Forum Discussion

krishnak's avatar
krishnak
New Member
6 years ago
Solved

Look up value help needed

Hi All, I am a beginner and working on a visual. The problem is best illustrated by the following table.

DateValueRequired Avg Value
4/1/2019342Avg of 342, 298
3/1/2019354Avg of 354, 298
2/1/2019308Avg of 308, 298
1/1/2019298Avg of 298, 298
3/1/2018344Avg of 344, 306
2/1/2018322Avg of 322, 306
1/1/2018306Avg of 306, 306

 

The resulting column should give an average of selected row value and the value for the beginning of the year. For 2019,  the year beginning value is the value for 1/1/2019 and for 2018, the value is for 1/1/2018.  

I added column in Data View extracting the year of the row and tried using it the LOOKUPVALUE function -

=LOOKUPVALUE([Value], [DATE],DATE (Year (extracted value), 1, 1)

It appears that I cannot use the value from another column in the Search value function.

Please advise me how I can solve this problem.

Thanks in advance.

  • Hello krishnak ,

     

    You may try this:

    Answer = 
    VAR _YearStart =
        LOOKUPVALUE (
            Sheet2[Value],
            Sheet2[Date], DATE ( YEAR ( Sheet2[Date] ), 1, 1 )
        )
    VAR _Current = Sheet2[Value]
    VAR _Avg =
        DIVIDE ( _YearStart + _Current, 2 )
    RETURN
        _Avg

     

    Result

     

    Cheers!
    Vivek

    If it helps, please mark it as a solution
    Kudos would be a cherry on the top 🙂 (Hit the thumbs up button!)
    If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)


    https://www.vivran.in/

    Connect on LinkedIn

4 Replies