Forum Discussion
Anonymous
3 years agoNot applicable
Advanced IF function
Hello, I am pretty new in Power BI and I am trying to figure out how can I do my task. I need to write a dax (probably by function IF) where when day of the month is less or equal to 5, I need to...
v-yadongf-msft
3 years agoCommunity Support
Hi Anonymous ,
Please try following DAX:
Cost = SWITCH(
TRUE(),
MAXX(FILTER('Table','Table'[Month] = MONTH(TODAY())),'Table'[Day])<=5,[VNC+ Import]*1.04,
'Table'[Month] = MONTH(TODAY()) && MAXX(FILTER('Table','Table1'[Month] = MONTH(TODAY())),'Table'[Day])>6,[VNC+ Import]*1.04
)
I did test in two tables and both worked.
Test table 1, until Oct 7th:
Test table 2, until Oct 3rd:
Best regards,
Yadong Fang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
3 years agoNot applicable
Hello,
unfortunately, it is not working for me and I do not know why. I tied exactly what you suggested, but no matter what, it is still multypling only this month and all data from previous months just disappear, which is not good. Even when I tied lower numbers of day, it still multiplied only this new month, never last month.