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

Next 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

Reply
Anonymous
Not applicable

Expression with the Today () function

I need to create a measure or column that should use the Today () function.

 

I have a table with two columns of dates, one that is due date that is of type null and the other that is extension date and can have null values, to that extent I need to show the number of days that are missing or the Number of days that passed the date of the extension when it is null and the date of expiration when the date of extension is null.

 

I tried to use the function today () but with no success.

 

Dt. FinalDt. Prorrogaçãoà vencer (dias)
30/12/2016 -7
08/10/2017 275
08/09/201509/12/2015-394
08/09/201609/05/2016-242
1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Sean

I created the measure but the following error is occurring:

 

"A single value for column 'Dt. Extension' in table 'DMEGF_ContractsSupplier' can not be determined." This can happen when a measure refers to a column that contains many values without specifying an aggregation such as min, max, count, or to Get a single result. "

 

If (ISBLANK (DMEGF_ContractsSupplier);

DMEGF_ContractsProvider [Dt. Final] - TODAY ();

DMEGF_ContractsProvider [Dt. Extension] - TODAY ())

View solution in original post

5 REPLIES 5
Vvelarde
Community Champion
Community Champion

@Anonymous

 

Hi, Look this thread, i think would be part of the solution

 

https://community.powerbi.com/t5/Desktop/How-to-use-DATEDIFF-when-End-Date-is-less-than-Start-Date/td-p/37495




Lima - Peru
Sean
Community Champion
Community Champion

@Anonymoussince you're always dealing with TODAY - you just need to check IF there has been an extenstion to determine which date to use in the subtraction (at least that's how I understand your question)

If that is the case you can try this

 

Column (Days) =
IF (
    ISBLANK ( 'Table'[Dt. Prorrogação] );
    'Table'[Dt. Final] - TODAY ();
    'Table'[Dt. Prorrogação] - TODAY ()
)

Dates from TODAY.png

 

EDIT: You may have to change the Data Type of the Column in the Modeling Tab to Whole Number otherwise will show you dates!

Anonymous
Not applicable

@Sean

I created the measure but the following error is occurring:

 

"A single value for column 'Dt. Extension' in table 'DMEGF_ContractsSupplier' can not be determined." This can happen when a measure refers to a column that contains many values without specifying an aggregation such as min, max, count, or to Get a single result. "

 

If (ISBLANK (DMEGF_ContractsSupplier);

DMEGF_ContractsProvider [Dt. Final] - TODAY ();

DMEGF_ContractsProvider [Dt. Extension] - TODAY ())

Sean
Community Champion
Community Champion

@AnonymousThis is a Calculated Column not a Measure!

Sean
Community Champion
Community Champion

@Anonymous

If you want a Measure try this instead

 

Measure =
IF (
    ISBLANK ( DMEGF_ContractsProvider[Dt. Extension] );
    ( MIN ( DMEGF_ContractsProvider[Dt. Final] ) - TODAY () )
        * 1;
    ( MIN ( DMEGF_ContractsProvider[Dt. Extension] ) - TODAY () )
        * 1
)

Good Luck! Smiley Happy

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.