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
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
Memorable Member
Memorable Member

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
Memorable Member
Memorable Member

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
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.