Forum Discussion
West2345
3 years agoNew Member
Too few arguments were passed to the IF function. The minimum argument count for the function is 2.
Hi, I am new to Power Bi and I am struggling with DAX. I have this function in order to print out Seasons but it is giving me an error. How can I fix this?
Seasons =
IF(OR(Holiday[Month of travel) ==12,
IF (Holiday[Month of travel] <3, "Winter", IF(Holiday[Month of travel] <6, "Spring",
IF (Holding [Month of travel]<9, "Summer", "Autumn")))))
2 Replies
- ppm1
Solution Sage
It is possible to do that with nested IF, but you may want to learn about the SWITCH function (and it's use with TRUE() for these scenarios). Fixed IF also shown.
Seasons = SWITCH ( TRUE (), Holiday[Month of travel] IN { 1, 2, 12 }, "Winter", Holiday[Month of travel] IN { 3, 4, 5 }, "Spring", Holiday[Month of travel] IN { 6, 7, 8 }, "Summer", "Autumn" ) Seasons = IF ( OR ( Holiday[Month of travel] = 12, Holiday[Month of travel] < 3 ), "Winter", IF ( Holiday[Month of travel] < 6, "Spring", IF ( Holding[Month of travel] < 9, "Summer", "Autumn" ) ) )Pat