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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Solution Specialist
Solution Specialist

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
Solution Specialist
Solution Specialist

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.