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
ALOPEZ
New Member

create a measure of time that subtracts a date field with the today function

hello forum

I have a Billing table that includes a billing date field. I need to calculate a measure that subtracts the billing date field using the today() function to calculate the number of days since it was billed.

I tried to do this but it gives me an error because it expects the field to have a single value.

 

The code of measure with error:

Dias =
VAR VENCIMIENTO = CUEN_M01[FECHA_VENC]
VAR HOY = TODAY()
VAR _RESULT = HOY-VENCIMIENTO

RETUNR
_RESULT

 

ALOPEZ_0-1681831717840.png

Thak you

2 ACCEPTED SOLUTIONS
pranit828
Community Champion
Community Champion

Hi @ALOPEZ ,
Please try...

 

Dias =
VAR VENCIMIENTO = SELECTEDVALUE(CUEN_M01[FECHA_VENC])
VAR HOY = TODAY()
VAR _RESULT = HOY-VENCIMIENTO

 

RETURN
_RESULT




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

View solution in original post

Bmejia
Responsive Resident
Responsive Resident

Can also use the function DATEDIFF

Datediff = SUMX('CUEN_M01'DATEDIFF(CUEN_M01[FECHA_VENC]TODAY() ,DAY))

View solution in original post

2 REPLIES 2
Bmejia
Responsive Resident
Responsive Resident

Can also use the function DATEDIFF

Datediff = SUMX('CUEN_M01'DATEDIFF(CUEN_M01[FECHA_VENC]TODAY() ,DAY))
pranit828
Community Champion
Community Champion

Hi @ALOPEZ ,
Please try...

 

Dias =
VAR VENCIMIENTO = SELECTEDVALUE(CUEN_M01[FECHA_VENC])
VAR HOY = TODAY()
VAR _RESULT = HOY-VENCIMIENTO

 

RETURN
_RESULT




PBI_SuperUser_Rank@1x.png


Hope it resolves your issue? 
Did I answer your question? Mark my post as a solution!

Appreciate your Kudos, Press the thumbs up button!!
Linkedin Profile

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.