Forum Discussion

AllanBerces's avatar
AllanBerces
Post Prodigy
5 months ago
Solved

IF Condition

Hi gooday can anyone correct my If condtion. What i need is if the week is already pass it should be equal to 0, so from Week 1 to 11 it should be zero and from Week 12 onward should be equal to my forecasthour

 

FORECAST = IF('Table'[FORECASTHOURS] >  WEEKNUM(TODAY()), 0, 'Table'[FORECASTHOURS])
 
Thank you
  • Hii AllanBerces 

     

    Your logic is slightly incorrect. You should compare the week column with the current week (WEEKNUM(TODAY())), not the forecast value.

    FORECAST =
    IF(
        'Table'[Week] < WEEKNUM(TODAY()),
        0,
        'Table'[FORECASTHOURS]
    )

3 Replies

  • Hii AllanBerces 

     

    Your logic is slightly incorrect. You should compare the week column with the current week (WEEKNUM(TODAY())), not the forecast value.

    FORECAST =
    IF(
        'Table'[Week] < WEEKNUM(TODAY()),
        0,
        'Table'[FORECASTHOURS]
    )
  • Nice solution, That makes perfect sense, comparing the week number directly instead of the forecast hours is definitely the way to go. Clean and logical fix.

    On a side note, if anyone here likes to unwind after troubleshooting DAX formulas by streaming or storing files, you might want to check out Terabox for cloud storage and Wink for editing and sharing videos. Pretty handy tools!