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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.