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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

subtract a day from a date in a measure

This looks so simple but i cant get it to work.

 

I have a table with a column filled with dates:  estoque[date]

 

I just want to show in a card that date -1 day

 

My initial idea was to create a measure and put that measure inside a card and put in inside a report.

 

I cant figure out how to do it. Some basic concept on how measures work I tried 

Measure 2 = CALCULATE(DATEADD('Estoque'[date],-1,DAY))
but it doenst work on a measure card.
 
WHat am I doing wrong.
1 ACCEPTED SOLUTION
nandic
Super User
Super User

Hi,
If there are multiple date values this calculation will not work.
Measure in card expects one value, and if there are multiple dates it will fail. Also measure would expected another aggregation like min, max to display unique value.
But if you create calculated column then you will be able to display that value in visualization like list, matrix, but still not in card.
Card visualization will work only if unique value is expected.

 

Regards,
Nemanja Andic

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

You need to use the DATEADD dax function. click here for more info

nandic
Super User
Super User

Hi,
If there are multiple date values this calculation will not work.
Measure in card expects one value, and if there are multiple dates it will fail. Also measure would expected another aggregation like min, max to display unique value.
But if you create calculated column then you will be able to display that value in visualization like list, matrix, but still not in card.
Card visualization will work only if unique value is expected.

 

Regards,
Nemanja Andic

Anonymous
Not applicable

Thank you for the help ! I figured it out ... 

 

here is my final DAX expression : 

 

Measure 2 = CALCULATE(DATE(YEAR(max(Estoque[date])),MONTH((max(Estoque[date]))),DAY(max(Estoque[date])-1)))
 

 

@Syndicate_Admin Thank you for your input. I'm trying to subtract 5 days from a particular date. That is, an event happens 5 days before that date, that data helps me to obtain a new date, the date of occurrence of the event.
I was looking at your feature but it doesn't work for me, any ideas?
"Event Date = Closing Date - 5 days"
Thank you

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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