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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
imranamikhan
Helper V
Helper V

Set text value for future months if record had ever changed in a previous month

Hi everyone,


I have a table which contains:

 

  • Customer IDs
  • A Timestamp date column for the end of each month
  • A text column called “Trade Type”
  • A text column which displays a Baseline Status
  • A text column which displays a Revised Status

Each record starts with a baseline value of “Inactive”. If the trade type value changes in the following month, the Revised Status should be “Reactivated” in the current month, and then “Active” for future months. It does not matter if the Trade Type value changes again, it only has had to change once in a prior month for a record to be considered “Active” for future months.

 

example.PNG

 

My solution is to use 5 calculated columns but I cannot work out how to set a record to display “Active” for future months. Could anyone advise a better solution?

 

1. Identify the trade type value in the previous month with a calculated column:

 

PreviousTT = CALCULATE (
    MAX ( Fact_MD_Current[Trade Type] ),
    FILTER (
        Fact_MD_Current,
        Fact_MD_Current[Customer] = EARLIER ( Fact_MD_Current[Customer] )
            && MONTH ( Fact_MD_Current[Record Timestamp] )
                = MONTH ( EDATE ( EARLIER ( Fact_MD_Current[Record Timestamp] ), -1 ) )
    )
)

 

2. Determine if the Current Trade Type value has changed by comparing Previous Trade Type with the Current Trade Type:

 

DifferentTT = IF(Fact_MD_Current[Record Timestamp]=MIN(Fact_MD_Current[Record Timestamp]),FALSE,Fact_MD_Current[Trade Type]<>Fact_MD_Current[PreviousTT])

 

3. Return “Reactivated” if the Baseline Status is "Inactive" and the DifferentTT column returns TRUE

 

Reactivated = IF(AND([MD Status Baseline]="Inactive"=TRUE,Fact_MD_Current[DifferentTT]),"Reactivated", "Not Reactivated"))

 

4. Check if in the Previous Month, the text value for the Reactivated column was “Reactivated”

 

Reactivated Previous Month = CALCULATE (

    MAX ( Fact_MD_Current[Reactivated] ),

    FILTER (

        Fact_MD_Current,

        Fact_MD_Current[Customer] = EARLIER ( Fact_MD_Current[Customer] )

            && MONTH ( Fact_MD_Current[Record Timestamp] )

                = MONTH ( EDATE ( EARLIER ( Fact_MD_Current[Record Timestamp] ), -1 ) )

    )

)

 

5. Create a calculated column to return “Reactivated” if the Reactivated calculated column = “Reactivated”. Otherwise, if the Reactivated Previous Month column returns "Reactivated", then return “Active”, otherwise return the Baseline Status.

 

Revised Status = 
            IF([Reactivated]="Reactivated",
            "Reactivated",
            IF([Reactivated Previous Month]="Reactivated",
            "Active", 
            Fact_MD_Current[MD Status Baseline]))

 

 

best regards,

AmiKhan

1 ACCEPTED SOLUTION
smpa01
Super User
Super User

@imranamikhan  can you please try this

https://drive.google.com/file/d/1GzkzpCfUo-wEtJqdy2ZRhW1EMgQ4CTQH/view?usp=sharing

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

2 REPLIES 2
imranamikhan
Helper V
Helper V

Seriously impressive work - this is exactly what I asked for and I have learned a lot from your approach. Thank you very much @smpa01

smpa01
Super User
Super User

@imranamikhan  can you please try this

https://drive.google.com/file/d/1GzkzpCfUo-wEtJqdy2ZRhW1EMgQ4CTQH/view?usp=sharing

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors
Top Kudoed Authors