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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
awaldron
Regular Visitor

How to determine text value to display from prior month

I am trying to create a SKU status based on the SKU creation date and the number of units sold in the last 12 months. If the SKU status is inactive, it needs to stay inactive, otherwise continue using the logic.

 

Below if my current DAX calculated column, but I need to figure out a way to make the SKU status remain Inactive once it becomes Inactive:

SKU Status = IF(
    [Date_time_year]=2019,
    "",
    IF([Month_Diff]<12,
    "Active",
    IF(CALCULATE(MAX([Month_Diff]))<37,
    "Active",
    IF(Summary Facts'[Sales_Qty_L12M]<51,
    "Inactive",
    "Active"))))

Below is an example output:

awaldron_0-1701376213799.png

 

1 ACCEPTED SOLUTION
123abc
Community Champion
Community Champion

Your current DAX formula looks close, but it needs a modification to ensure that once the SKU status becomes "Inactive," it remains "Inactive" in the future months. You can achieve this by introducing an additional condition to check if the current SKU status is "Inactive" and if the current month difference is greater than or equal to 12.

Here's a modified version of your DAX formula:

 

SKU Status =
IF(
[Date_time_year] = 2019,
"", -- Assuming you want a blank value for the year 2019
IF(
[Month_Diff] < 12,
"Active",
IF(
CALCULATE(MAX([Month_Diff])) < 37,
"Active",
IF(
SummaryFacts'[Sales_Qty_L12M] < 51,
"Inactive",
IF(
[Previous_SKU_Status] = "Inactive" && [Month_Diff] >= 12,
"Inactive",
"Active"
)
)
)
)
)

 

In this modification, I introduced a hypothetical [Previous_SKU_Status] column, which represents the SKU status in the previous month. You should replace [Previous_SKU_Status] with the actual column or measure that represents the SKU status in the previous month.

This modification ensures that if the SKU status is "Inactive" and the current month difference is greater than or equal to 12, it remains "Inactive"; otherwise, it stays "Active." Adjust the column or measure names as needed based on your data model.

 
 
 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

View solution in original post

1 REPLY 1
123abc
Community Champion
Community Champion

Your current DAX formula looks close, but it needs a modification to ensure that once the SKU status becomes "Inactive," it remains "Inactive" in the future months. You can achieve this by introducing an additional condition to check if the current SKU status is "Inactive" and if the current month difference is greater than or equal to 12.

Here's a modified version of your DAX formula:

 

SKU Status =
IF(
[Date_time_year] = 2019,
"", -- Assuming you want a blank value for the year 2019
IF(
[Month_Diff] < 12,
"Active",
IF(
CALCULATE(MAX([Month_Diff])) < 37,
"Active",
IF(
SummaryFacts'[Sales_Qty_L12M] < 51,
"Inactive",
IF(
[Previous_SKU_Status] = "Inactive" && [Month_Diff] >= 12,
"Inactive",
"Active"
)
)
)
)
)

 

In this modification, I introduced a hypothetical [Previous_SKU_Status] column, which represents the SKU status in the previous month. You should replace [Previous_SKU_Status] with the actual column or measure that represents the SKU status in the previous month.

This modification ensures that if the SKU status is "Inactive" and the current month difference is greater than or equal to 12, it remains "Inactive"; otherwise, it stays "Active." Adjust the column or measure names as needed based on your data model.

 
 
 

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.

 

In case there is still a problem, please feel free and explain your issue in detail, It will be my pleasure to assist you in any way I can.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.