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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
capricornucopia
Frequent Visitor

Create flag column for when category has new date

I have a table containing date, audience, advertisement, and spend associated with the audience or ad. I'm looking for a way to flag whether there is a new date for a category (i.e., audience or ad) that begins spending within the last week. For example, if the prospect audience begins spending (spend > 0) on 1/5/26, I want the flag column to return a 1 for the prospect audience because it began spending within the last week (12/31/25 - 1/6/26). If its spend began instead on 12/1/25, then it will return a 0 because it is longer than a week ago. Thanks in advance for the help!

1 ACCEPTED SOLUTION
mizan2390
Resolver III
Resolver III

Assuming your table is called FactSpend with columns:  Date,  Audience,  AdvertisementSpend
If the category is Audience: Try
FirstSpendDate_Audience =
CALCULATE (
MIN ( FactSpend[Date] ),
FILTER (
ALL ( FactSpend ),
FactSpend[Audience] = EARLIER ( FactSpend[Audience] )
&& FactSpend[Spend] > 0
)
)

 Flag if first spend is within last 7 days

NewAudienceFlag_Last7Days =
VAR FirstDate =
[FirstSpendDate_Audience]
VAR TodayDate =
TODAY ()
RETURN
IF (
NOT ISBLANK ( FirstDate )
&& FirstDate >= TodayDate - 7
&& FirstDate <= TodayDate,
1,
0
)

View solution in original post

2 REPLIES 2
mizan2390
Resolver III
Resolver III

Assuming your table is called FactSpend with columns:  Date,  Audience,  AdvertisementSpend
If the category is Audience: Try
FirstSpendDate_Audience =
CALCULATE (
MIN ( FactSpend[Date] ),
FILTER (
ALL ( FactSpend ),
FactSpend[Audience] = EARLIER ( FactSpend[Audience] )
&& FactSpend[Spend] > 0
)
)

 Flag if first spend is within last 7 days

NewAudienceFlag_Last7Days =
VAR FirstDate =
[FirstSpendDate_Audience]
VAR TodayDate =
TODAY ()
RETURN
IF (
NOT ISBLANK ( FirstDate )
&& FirstDate >= TodayDate - 7
&& FirstDate <= TodayDate,
1,
0
)

Thank you so much, that looks to have worked!

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.