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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
kleedt
Frequent Visitor

Get value for previous day for a string

Hello,

 

I have a column [promotionStatus] indicating for each day ([Date]) whether a product ([EAN])is on promotion or not.

 

I now want to create a measure with [promoStatus] value of the previous day, so I can then flag when the promotion status of an EAN has changed.

 

For this, I have created this measure:

Promo Status previous day = CALCULATE(SELECTEDVALUE('Table'[promotionStatus]), DATEADD('Table'[Date], -1, DAY))
 
This however leads to strange behavior, as PowerBi now seems to skip days where promo status is changing. See example below.
kleedt_0-1670342171370.pngkleedt_1-1670342187182.png

Expected outcome would be for August 7th to have Table[promotionStatus]="on promotion" and 'Promo Status previous day' = "not on promotion"

 

Any idea on what is leading to this beavior and how to fix it?

 

Many thanks!

5 REPLIES 5
kleedt
Frequent Visitor

Hi @Uspace87 ,

 

thanks for the quick reply.

 

[Date] is part of the same table as [promotionStatus] and [EAN].

 

I created a date table and linked it to DIM table, but now the "Promo Status previous day" measure either produces an empty table or, if I create it as calculated column instead of measure, an empty column.

if you have already a Dim Date Table just link the DateKey to Date into your Fact table.

 

Check if the dates are correctly formatted in both tables. It should work

Uspace87
Resolver III
Resolver III

@kleedt 

 

For me is working:

 

Uspace87_0-1670343011839.png

Was in promo = CALCULATE(
    SELECTEDVALUE(Promo[Promo]),
    DATEADD(Promo[Date],-1,DAY)
)
 
I think you need to connect you Dim Date table to the "Date" in the "Table"

Uspace87_0-1670343103421.png

 

@Uspace87 

When I use Date and Dim tabel with established connection on date key, no rows are skipped. However, the measure is not giving output as expected (see below). I have not changed the measure, other than referencing Date tabel in DATEADD part of the measure.

 

kleedt_0-1670833183182.png

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.