Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear All,
I need a measure that calculates a value based on the actual date.
For example: I have a value of € 3000.
What I would do is creating the following measure:
DAY TO DAY VALUE: 3000 / 31 [days in a month] * DAY(TODAY).
But this is wrong because I need the measure to take into consideration the actual date while this is going to reset the value each month.
Desired result is as following (Considering today 07/02/2022):
Month | Value (€) |
Jan 22 | 3000 |
Feb 22 | 677,4 |
Mar 22 | 0 |
Apr 22 | 0 |
May 22 | 0 |
I hope you can give me a feedback on this 😕
Thank you very much
Solved! Go to Solution.
Hi @gianmarco ,
According to the screenshot, when
year-month <Today's —— 3000,
year-month =Today's —— 3000 / total days of previous month * day of Today
year-month >Today's ——0
If so , please try:
Value(€) =
var _diff=DATEDIFF(TODAY(),MAX('Table'[Month]),MONTH)
var _totalDaysOfPreviousMonth=DAY(EOMONTH(MAX('Table'[Month]),-1))
return SWITCH(TRUE(),
_diff<0, 3000,
_diff=0, DIVIDE(3000,_totalDaysOfPreviousMonth) * DAY(TODAY()),
_diff>0,0
)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @gianmarco ,
According to the screenshot, when
year-month <Today's —— 3000,
year-month =Today's —— 3000 / total days of previous month * day of Today
year-month >Today's ——0
If so , please try:
Value(€) =
var _diff=DATEDIFF(TODAY(),MAX('Table'[Month]),MONTH)
var _totalDaysOfPreviousMonth=DAY(EOMONTH(MAX('Table'[Month]),-1))
return SWITCH(TRUE(),
_diff<0, 3000,
_diff=0, DIVIDE(3000,_totalDaysOfPreviousMonth) * DAY(TODAY()),
_diff>0,0
)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @gianmarco
In order to return the days in a month without having it reseted you can use the following code
DAY(EOMONTH(your_month_Column;0))
Did it work ? 👌Mark it as a solution to help spreading knowledge 👉A kudos would be appreciated
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
99 | |
80 | |
70 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |