Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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 add to my price 4% costs, for these 5 days of new month and all previous month. But when day of the month passes 6 and more, I need add to the price 4% only for this new month. No more previous month.
Example: If now is second day of new month, I need + 4% to my price for this new month (2 days) and all days of previous month. If now is 6th day of the new month, I need + 4% to my price only for this month and no more for previous month.
Can someone help me please?
This is one of my many attempts, but this is not working properly.
Hi @Anonymous ,
It's so strange!
Can you share with me some sample data in table like this?
Best regards,
Yadong Fang
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.
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.
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
13 | |
11 | |
9 | |
6 |