Skip to content
The Chat Archive
gpt-3.5-turbo-0613· OpenAI WildChat-4.8M (AI2)

Modify the function. Now, if year = 2022 and 2023 and month is from 1 and 6, it returns…

  1. User

    Modify the function. Now, if year = 2022 and 2023 and month is from 1 and 6, it returns 362. 362 is the number of days in the first 6 months in 2022 and 2023. But if I select only 2023, the resuld does not change

    Number_of_days_selected = DATEDIFF( DATE(MIN('Calendar'[Year]),MIN('Calendar'[Month]),1), DATE(MIN('Calendar'[Year]),MAX('Calendar'[Month])+1,1)-1,DAY )+1 + DATEDIFF( DATE(MAX('Calendar'[Year]),MIN('Calendar'[Month]),1), DATE(MAX('Calendar'[Year]),MAX('Calendar'[Month])+1,1)-1,DAY )+1

  2. Assistant

    Number_of_days_selected = IF( AND( OR('Calendar'[Year] = 2022, 'Calendar'[Year] = 2023), 'Calendar'[Month] >= 1, 'Calendar'[Month] <= 6 ), 362, DATEDIFF( DATE(MIN('Calendar'[Year]), MIN('Calendar'[Month]), 1), DATE(MIN('Calendar'[Year]), MAX('Calendar'[Month]) + 1, 1) - 1, DAY ) + 1 + DATEDIFF( DATE(MAX('Calendar'[Year]), MIN('Calendar'[Month]), 1), DATE(MAX('Calendar'[Year]), MAX('Calendar'[Month]) + 1, 1) - 1, DAY ) + 1 )