Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
gianmarco
Helper IV
Helper IV

Need help with day to day measure

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):

MonthValue (€)
Jan 223000
Feb 22677,4
Mar 220
Apr 220
May 220

 

I hope you can give me a feedback on this 😕

Thank you very much

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

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
         )

Eyelyn9_0-1644548574521.png

 

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.

View solution in original post

3 REPLIES 3
v-eqin-msft
Community Support
Community Support

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
         )

Eyelyn9_0-1644548574521.png

 

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.

Exactly what i was looking for! Thank you so much @v-eqin-msft 

DataVitalizer
Super User
Super User

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.