Forum Discussion

sophtee's avatar
sophtee
Icon for Helper I rankHelper I
2 years ago
Solved

How to insert a default value when there so no value in the lookup table?

Hello eveyone,  I created a lookup for the "Ageflk" and it would return the average of a specific age. However, it do not have all the age and I would like to put a default value 75 if there are any...
  • PijushRoy's avatar
    2 years ago

    Hi sophtee 

    Can you please try below DAX

     

    Proj Eggs Hch% =
    
    VAR _a = T4[Ageflk]
    VAR tmp = FILTER(T1, T1[Ageflk] = _a)
    RETURN 
    SWITCH(
    TRUE(),
    ISBLANK(AVERAGEX(tmp, T1[%Hch])),75,
    AVERAGEX(tmp, T1[%Hch])
    )

     


    Let me know if that works for you


    If your requirement is solved, please mark THIS ANSWER as SOLUTION ✔️ and help other users find the solution quickly. Please hit the Thumbs Up 👍 button if this comment helps you.

    Thanks
    Pijush
    Linkedin