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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.