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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
aDrieZ
New Member

Use a date value to transform an integer - cannot convert value 'September' of type Text to type Int

Hi all, i am new to PowerBI.
I receive a date value from our database as well as an integer (number of days to deadline).
The problem is, that this value is always positiv, also when the deadline is missed.
So i want to use the date value to transform the daysToDeadline value into a negativ value when the date is lower than today.
I have tried the way excel does this, but this won't work.

Here is my code::

 

anpVerzug = IF(AND(DATE(qryAuftraegeAnDisplays[Starttermin_Plan].[Jahr],qryAuftraegeAnDisplays[Starttermin_Plan].[Monat],qryAuftraegeAnDisplays[Starttermin_Plan].[Tag]) < TODAY(), NOT ISBLANK(qryAuftraegeAnDisplays[Starttermin_Plan])), qryAuftraegeAnDisplays[Verzug] * -1, qryAuftraegeAnDisplays[Verzug])

 

Starttermin_Plan is the date
Verzug is the number of days to deadline.

How can i solve this?

1 REPLY 1
HotChilli
Community Champion
Community Champion

I think you can simplify the date comparison and it will reduce to this:

anpVerzug = IF(AND(qryAuftraegeAnDisplays[Starttermin_Plan] < TODAY(), NOT ISBLANK(qryAuftraegeAnDisplays[Starttermin_Plan])), qryAuftraegeAnDisplays[Verzug] * -1, qryAuftraegeAnDisplays[Verzug])

I haven't tested it, try it out

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.