Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Two Calculated Columns with the same formulas are returning different results

Hello,   I have a date table set up with two calculated columns- One returns "Current Week" and the other returns "Prior Week" Current week is defined as  ISCURRENTWEEK = IF(WEEKNUM(TODAY()...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    • If there is a relationship between the result and search tables, in most cases, using RELATED function instead of LOOKUPVALUE is more efficient and provides better performance.

    • The search_value and alternateResult parameters are evaluated before the function iterates through the rows of the search table.

    • Avoid using ISERROR or IFERROR functions to capture an error returned by LOOKUPVALUE. If some inputs to the function will result in an error when a single output value cannot be determined, providing an alternateResult parameter is the most reliable and highest performing way to handle the error.

    You could try below formula:

    CurrentWeek = calculate(max(DateTable[ISCURRENTWEEK]),filter(DateTable,DateTable[WeekOfYearKey]=FactTable[WeekOfYearKey]))

     

    Best Regards,

    Jay