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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

How to multiple the last value with an increasing factor in DAX

I'd want to take the most recent value of Amount, which is sorted by date, then multiply it by increasing rate factor. For example, I'd like to know how much the Amount is increasing by 5% per day.

 

Date                   Amount
1/01/202124651
2/01/202154835
3/01/202121364
4/01/202112465
5/01/20214878
6/01/20211235
7/01/2021256363
8/01/2021215687
9/01/20217895
10/01/20211210
11/01/202156460
12/01/202148790
13/01/20211544
14/01/202178456

 

For instance, I anticipate the following Amount (15/1/2021) to be 78456 + 78456*0.05 = 82378.8, followed by (16/1/2021) 82378.8 + 82378.8 * 0.05 = 86497.74... and so on.

 

How can I do that in DAX please?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , A measure with help from date table

 

measure = 
var _max = maxx(allselected(Data), Data[Date]) 
var _amt = calculate(lastnonblankvalue('Date'[Date], sum(Data[Amount])), allselected())
return if(Max('Date'[Date]) <=_max, sum(Data[Amount]), _amt* power(1.05, datediff(_max, Max('Date'[Date]), Day)+1) )

 

file attached after signature

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , A measure with help from date table

 

measure = 
var _max = maxx(allselected(Data), Data[Date]) 
var _amt = calculate(lastnonblankvalue('Date'[Date], sum(Data[Amount])), allselected())
return if(Max('Date'[Date]) <=_max, sum(Data[Amount]), _amt* power(1.05, datediff(_max, Max('Date'[Date]), Day)+1) )

 

file attached after signature

Anonymous
Not applicable

Hi Amit,

 

Thank you so much for your help. This works perfectly. One question though, it does not work when I try to slice it by date, giving me blank value. How can I achive that with an existing measure? I appreciate your help. 🙂

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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