Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 9 | |
| 5 | |
| 5 |