Forum Discussion
Dynamic Percentage
Create Measures for Starting Price and Current Price:
Starting Price =
CALCULATE(
FIRSTNONBLANK(Main[Price], 1),
FILTER(
Main,
Main[Date] = CALCULATE(MIN(Main[Date]), ALLSELECTED(Main[Date]))
)
)
Current Price =
CALCULATE(
LASTNONBLANK(Main[Price], 1),
FILTER(
Main,
Main[Date] <= MAX(Main[Date]) && Main[Date] >= MIN(Main[Date])
)
)
Percentage Change Measure:
Percentage Change =
VAR StartPrice = [Starting Price]
VAR CurrentPrice = [Current Price]
RETURN
IF(
ISBLANK(StartPrice),
BLANK(),
DIVIDE(CurrentPrice - StartPrice, StartPrice, 0) * 100
)
- Anonymous1 year agoNot applicable
Hi Kedar_Pande
Thank you for the reposne.
I tried with your method but its still not showing the result.
For your refernce I am giving the link so you can have look on data.
My Drive - Google Drive- Anonymous1 year agoNot applicable
Hi Anonymous ,
Unfortunately Due to environmental reasons, we can't open the Pbix file you uploaded, we try to use the sample data to solve your problem, we modified the original basis of your code, and got the following results Hope it will help you!Measure 2 = VAR BaseDate = MINX(ALLSELECTED('Table'), 'Table'[Date]) VAR BasePrice = CALCULATE(SUM('Table'[Price]), 'Table'[Date] = BaseDate,ALL('Table')) VAR CurrentPrice = SUM('Table'[Price]) VAR Result = DIVIDE(CurrentPrice - BasePrice, BasePrice, 0) RETURN ResultIf you have any other questions, you can check the pbix file I uploaded, I hope it will help you, if you have any further questions, you can contact me anytime, I will get back to you as soon as I receive the message!
Hope it helps!
Best regards,
Community Support Team_ Tom ShenIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous1 year agoNot applicable
Hello Anonymous
I tried with your given DAX but its stilll not working and I dont know how to attach file in reply.
could you let me know how to attache the file so that i can share with you the sample file that i have created?