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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
avulasandeep
Helper III
Helper III

How to get product status which changed or not changed for Last 60 Number of days

Hi Power BI Masters,

 

Here i have one question which i  need using dax,

 

I need the product  status which is  changed or not changed for last n Number of days.

 

 For Example if the product A having status constant for last 60 days then it moved to not changed  category or  if product A status changed to  then it moved to changed category. PLease provide the formula using DAX.

 

avulasandeep_0-1602092137511.png

 

Attaching Powerbi Pbix file in this link :

sample report.pbix - Google Drive

 

Appriciated for quick response Advance thanks

 

 

Thanks 

sandeep

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @avulasandeep 

 

You may try the following measure.

Result = 
var _category = SELECTEDVALUE(Sheet1[Category])
var result = 
CALCULATE(
    DISTINCTCOUNT(Sheet1[Status]),
    FILTER(
        ALL(Sheet1),
        [Category]=_category&&
        [Date]<=TODAY()&&
        [Date]>=TODAY()-59
    )
)
return 
IF(
    result>1,
    "Changed",
    "Not Changed"
)

 

Result:

f1.png

 

Best Regards

Allan

 

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

View solution in original post

2 REPLIES 2
v-alq-msft
Community Support
Community Support

Hi, @avulasandeep 

 

You may try the following measure.

Result = 
var _category = SELECTEDVALUE(Sheet1[Category])
var result = 
CALCULATE(
    DISTINCTCOUNT(Sheet1[Status]),
    FILTER(
        ALL(Sheet1),
        [Category]=_category&&
        [Date]<=TODAY()&&
        [Date]>=TODAY()-59
    )
)
return 
IF(
    result>1,
    "Changed",
    "Not Changed"
)

 

Result:

f1.png

 

Best Regards

Allan

 

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

Fowmy
Super User
Super User

@avulasandeep 

Add this as a new column to your table:

 

Status Change M = 
VAR __STATTUS = [Status]
VAR _CAT = [Category]
VAR _DATE = [Date]
VAR _FOUND = 
COUNTROWS(
    FILTER(
        Sheet1,
        Sheet1[Category]<>_CAT && Sheet1[Date] < _DATE && Sheet1[Date] >= (_DATE - 60)
    )
)

RETURN
IF( _FOUND > 0, "Changed" , "Not Changed")

 

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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