Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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:
Solved! Go to Solution.
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.
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.
User | Count |
---|---|
16 | |
15 | |
14 | |
12 | |
11 |
User | Count |
---|---|
19 | |
15 | |
14 | |
11 | |
9 |