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
stacey
Frequent Visitor

If date is today-7 days then return a column

Hi all,

 

I have the below table:

stacey_1-1692097710300.png

The concept is: 

If the "last update" date is less than a week from today then return the text in "Summary" column, otherwise return "No updates".
Also if the text in "Summary" is empty return "No udpates".

 

Outcome should look like this

stacey_2-1692097755983.png

 

Thanks in advance

 

1 ACCEPTED SOLUTION

I am a bit closer now

 

NewSummary = IF(ISBLANK('Table'[Summary]),"No updates", if('Table'[Last Update]>=TODAY()-7,'Table'[Summary],"No updates"))

 

stacey_0-1692106668353.png

yes both [Summary] and [NewSummary] are columns

View solution in original post

6 REPLIES 6
sergej_og
Super User
Super User

Maybe this way, with TODAY()-7....

Summary =
IF(
Table[Last Update] = TODAY()-7
, "Match"
, "no match")

Result:

sergej_og_0-1692105437500.png

Thanks for the feedback. It's a bit different the outcome

ToddChitt
Super User
Super User

You need to investigate the DAX IF function:

IF function (DAX) - DAX | Microsoft Learn

TODAY function (DAX) - DAX | Microsoft Learn

You will need a nest IF for this, one to deal with comparing the Dates, and another for comparing the blank. Optionally, you could make BOTH compares with a single statement using the DAX OR operator.

 

Sure, we could write it out for you, but I encourage you to investigate adding the logic on your own. Start simple, with one IF statement, say on Date.

IF ( MyDate <= TODAY, <value to show if true>, <value to show if false> )




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





Thanks for the guidance


I'm probably missing something here

 

NewSummary = IF('Table'[Last Update]>=TODAY()-7,'Table'[Summary],if('Table'[Summary]="","No updates"))

stacey_0-1692105688370.png

 

You are comparing to an empty string

'Table'[Summary]=""
It is entirely possible that the field is BLANK. If so, use this:

ISBLANK('Table'[Summary]

Oh, and [Summary] is a column, right? Not a Measure?




Did I answer your question? If so, mark my post as a solution. Also consider helping someone else in the forums!

Proud to be a Super User!





I am a bit closer now

 

NewSummary = IF(ISBLANK('Table'[Summary]),"No updates", if('Table'[Last Update]>=TODAY()-7,'Table'[Summary],"No updates"))

 

stacey_0-1692106668353.png

yes both [Summary] and [NewSummary] are columns

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.