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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Otaki
Frequent Visitor

Price recursive calculation

Hi, I have the following issue:

I have the current price and I have to calculate the final and the future prices based on  previous ones with this formula:

Otaki_0-1644677220958.png

I've tried  this:

PriceEndTST_а =

var _max = MaxX(filter('Facts',COALESCE(Facts[InitialPrice],0)>0),Facts[year])
var _maxamt = minx(filter('Facts',Facts[year]=_max), Facts[InitialPrice]+(Facts[InitialPrice]*Facts[Increasepers]-Facts[DecreaseConst]))
var _maxMonth = maxx(filter('Facts',Facts[year]<=earlier(Facts[year])),Facts[year])
return
if(_maxMonth<=_max, ( Facts[InitialPrice]+(Facts[InitialPrice]*Facts[Increasepers]-Facts[DecreaseConst]))
,_maxamt+_maxamt*(sumx(filter(Facts, Facts[Year]>_max&& Facts[Year]<=_maxMonth), Facts[Increasepers]-Facts[DecreaseConst]/_maxamt))
but obviously  the result is incorrect:
Otaki_1-1644677744576.png

Could you, please help?

6 REPLIES 6
parry2k
Super User
Super User

@Otaki your reply doesn't help. What you have tried? What result you are getting? Can you provide more details, If you just say, it doesn't solve the issue, it is very hard to know what you have tried so far. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Otaki
Frequent Visitor

Sorry, @parry2k

The issue is that we don't actually have a cumulative percentage on one and the same value. we have to take exactly the previous value then multiply it with the exact percentage of the period and subtract the different parameters. With productX I still couldn't get the exact results.

parry2k
Super User
Super User

@Otaki check this video on my youtube channel, you need to use PRODUCTX function https://youtu.be/9Mj592bSKq0

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

 

Learn about conditional formatting at Microsoft Reactor

My latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Otaki
Frequent Visitor

unfortunately, productX doesn't  solve the issue 

Greg_Deckler
Super User
Super User

@Otaki Perhaps:

Final price column =
  VAR __Year = [Year]
  VAR __PreviousYear = __Year - 1
  VAR __PYFinalPrice = MAXX(FILTER('Facts',[Year]=__PreviousYear),[Final price])
RETURN
  __PYFinalPrice + __PYFinalPrice * [Increase Percent] - [Decrease const]

Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

This was actually my first idea however it doesn't work from the 3rd row on, as there are no values

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.