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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
schrodinger
New Member

Tracking Product wise price change

schrodinger_0-1655652177205.png

This is what the data looks like. Now, the problem statement is, I need to find the dates at which each product's price changed. This data keeps on updating on daily basis. I already have a slicer on my dashboard that allows me to select a product by Item ID.  So, if i select Item id 112 and from the price change slicer, I select True, it should give me the following output.

schrodinger_1-1655652200180.png

SO basically, I want to add a new column with boolean values (True/False), which shows True, if there is a cost change as compared to the previous cost and false if it is the same as the previous cost.

 

Price Change = IF(FILTER(Sheet1, Sheet1[Item ID]=EARLIER(Sheet1[Item ID]) && Sheet1[Rank]=EARLIER(Sheet1[Rank])+1 && Sheet1[Cost]<>EARLIER(Sheet1[Cost])),TRUE,FALSE)

 

I used this, but it's giving me an error 

schrodinger_2-1655652240424.png

 

 

1 ACCEPTED SOLUTION

@Vijay_A_Verma 's solution worked like a charm aswell!  

Price Change = IF(Sheet1[Rank]=1,TRUE(),(COUNTROWS(FILTER(Sheet1, Sheet1[Item ID]=EARLIER(Sheet1[Item ID]) && Sheet1[Rank]=EARLIER(Sheet1[Rank])-1 && Sheet1[Cost]<>EARLIER(Sheet1[Cost])))>0))

View solution in original post

4 REPLIES 4
schrodinger
New Member

Thank you everyone! 

rohit_singh
Solution Sage
Solution Sage

Hi @schrodinger ,

You can try something like this :

rohit_singh_0-1655715564943.png

 

Price Change =

var _cost = max(Parts[Cost])
var _dt = max(Parts[Date])

var _prevdt =
CALCULATE(
max(Parts[Date]),
FILTER(
ALLEXCEPT(Parts, Parts[Part Number],Parts[Item ID]),
Parts[Date] < _dt
)
)

var _prevcost =
CALCULATE(
max(Parts[Cost]),
FILTER(
ALLEXCEPT(Parts, Parts[Part Number],Parts[Item ID]),
Parts[Date] = _prevdt
)
)

Return

if(_cost = _prevcost , "False", "True")
 

Kind regards,

Rohit


Please mark this answer as the solution if it resolves your issue.
Appreciate your kudos! 🙂

@Vijay_A_Verma 's solution worked like a charm aswell!  

Price Change = IF(Sheet1[Rank]=1,TRUE(),(COUNTROWS(FILTER(Sheet1, Sheet1[Item ID]=EARLIER(Sheet1[Item ID]) && Sheet1[Rank]=EARLIER(Sheet1[Rank])-1 && Sheet1[Cost]<>EARLIER(Sheet1[Cost])))>0))

amitchandak
Super User
Super User

@schrodinger , This need to be something like that

Price Change = IF(Sheet1[Cost] = maxx(FILTER(Sheet1, Sheet1[Item ID]=EARLIER(Sheet1[Item ID])
&& Sheet1[Rank]=EARLIER(Sheet1[Rank])+1 ) ,Sheet1[Cost]),TRUE(),FALSE() )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.