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
DanielDelgado
New Member

Previous Cummulative price

Hi!

 

I am trying to calculate the previous cummulative price for each day. Is there a way that I can find it?

 

This is how my data looks like:

Each product has a code and a Price for each dayEach product has a code and a Price for each day

The last column has this formula:

 

PO Min Acumulado = IF(ISBLANK([AAAACC]);BLANK();CALCULATE(MIN([PO]);FILTER(ALLEXCEPT(AuxTable;AuxTable[Item Homologado];AuxTable[AAAA]);AuxTable[Date] <= MAX(AuxTable[Date]))))

 

What I want to calculate is, for each day & product, the previous cummulative minimun price. For example, in 07/01/2017 the price is 34.9, but the previous cummulative price was 35.9. So, in the same row of the 34.9 price I want to show the 35.9, which is the previous cummulative minimun price.

 

Thanks in advance!!

 

Daniel

1 ACCEPTED SOLUTION
v-danhe-msft
Employee
Employee

Hi @DanielDelgado,

Based on my test, you could refer to below formulas:

Create an index column firstly:

Index = RANKX('Table1',FIRSTNONBLANK('Table1'[Date],'Table1'[Date]),,ASC,Dense)

Create the po min Acumulado column:

po min Acumulado = var a=Table1[Index]
         var b=CALCULATE(MAX(Table1[PO]),FILTER('Table1','Table1'[Index]<=a))
         return b

Result:

1.PNG

 

 You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
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

3 REPLIES 3
v-danhe-msft
Employee
Employee

Hi @DanielDelgado,

Could you please tell me if your problem has been solved? If it is, could you please mark the helpful replies as Answered?

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-danhe-msft
Employee
Employee

Hi @DanielDelgado,

Based on my test, you could refer to below formulas:

Create an index column firstly:

Index = RANKX('Table1',FIRSTNONBLANK('Table1'[Date],'Table1'[Date]),,ASC,Dense)

Create the po min Acumulado column:

po min Acumulado = var a=Table1[Index]
         var b=CALCULATE(MAX(Table1[PO]),FILTER('Table1','Table1'[Index]<=a))
         return b

Result:

1.PNG

 

 You could also download the pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Ashish_Mathur
Super User
Super User

Hi,

 

Try this calculated column formula

 

=IF(ISBLANK([AAAACC]);BLANK();LOOKUPVALUE(MIN([PO]),[Date],CALCULATE(MIN([Date]);FILTER(AuxTable;AuxTable[Item Homologado]=EARLIER(AuxTable[Item Homologado])&&AuxTable[Date]<EARLIER(AuxTable[Date]))),[Item Homologado],[Item Homologado]))

 

Hope this helps.

 

 


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.