Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi there,
Is there anyway I can use a measure to calculate values in the same column? I have the column from date, to date and payment, need a measure to calculate the increase value as shown below. Please advise.
Solved! Go to Solution.
Hi, @sraj
There's only one bug with your formula:
Are these two columns the same? If it doesn't work, your actual data may not satisfy the logic in the code,
I have a simple method, you need to add a index column in power query first.
Then create a measure like this:
Inrease =
VAR a =
MAXX (
FILTER (
ALL ( kro_EMP_Payment ),
[Index]
= SELECTEDVALUE ( kro_EMP_Payment[Index] ) - 1
),
[PAYMENT]
)
RETURN
IF ( a <> BLANK (), SELECTEDVALUE ( kro_EMP_Payment[PAYMENT] ) - a )
Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,
Community Support Team _Janey
Got it, thank you very much!!
Hey @sraj ,
you can just consider the rows where the TO date is a day earlier than the FROM date.
An approach like this should work as a calculated column:
Inrease =
VAR vRowFromDayBefore = myTable[FROM] - 1
VAR vRowPayment = myTable[PAYMENT]
VAR vRowPaymnetDayBefore =
CALCULATE (
MAX ( myTable[PAYMENT] ),
myTable[TO] = vRowFromDayBefore,
ALL ( myTable )
)
RETURN
IF (
vRowPaymnetDayBefore <> 0 && vRowPaymnetDayBefore <> BLANK (),
vRowPayment - vRowPaymnetDayBefore
)
The result looks for me like this:
If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
Best regards
Denis
Blog: WhatTheFact.bi
Follow me: twitter.com/DenSelimovic
I dont know why I am seeing this, not sure what I am doing wrong?
Hi, @sraj
There's only one bug with your formula:
Are these two columns the same? If it doesn't work, your actual data may not satisfy the logic in the code,
I have a simple method, you need to add a index column in power query first.
Then create a measure like this:
Inrease =
VAR a =
MAXX (
FILTER (
ALL ( kro_EMP_Payment ),
[Index]
= SELECTEDVALUE ( kro_EMP_Payment[Index] ) - 1
),
[PAYMENT]
)
RETURN
IF ( a <> BLANK (), SELECTEDVALUE ( kro_EMP_Payment[PAYMENT] ) - a )
Did I answer your question? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,
Community Support Team _Janey
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
93 | |
90 | |
84 | |
70 | |
49 |
User | Count |
---|---|
141 | |
120 | |
112 | |
60 | |
58 |