This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
Hi All,
I have a dataset with a Transactions Table, I want to create a caculated column that checks for a TransactionType using the TansactionType ID Column and then returns a value based off a calculation on the Amount Column.
For example:
If TransactionType is 1, Return amount in Amount Column multiplied by 2
If TransactionType is 2, Return amount in Amount Column.
If TransactionType is 15, Return amount in amount table minus 500.
So bascially, I want a Calculated Column thats checks for a transactionID, and returns a calulation on the Amount Column.
Any help would be appreciated.
Try something like this.
Transaction Amount =
VAR TransactionID = Transaction[TansactionType ID]
VAR TransactionAmount = Transaction[Amount]
VAR ReturnAmount =
SWITCH (
TRUE (),
TransactionID = 1, TransactionAmount * 2,
TransactionID = 2, TransactionAmount,
TransactionID = 15, TransactionAmount - 500,
0
)
RETURN
Result
I tried this syntax:
HI @Anonymous ,
You code is okay.
You need to return Return Amount
Better Formatted Code
Revenue =
VAR TransactionID = Transactions[TransactionTypeId]
VAR TransactionAmount = Transactions[Amount($)]
VAR ReturnAmount =
SWITCH (
TRUE (),
TransactionID = 1
|| TransactionID = 5
|| TransactionID = 72
|| TransactionID = 66
|| TransactionID = 68
|| TransactionID = 69
|| TransactionID = 67, TransactionAmount,
TransactionID = 2, 6 * 360.5,
TransactionID = 49, TransactionAmount * 0.65,
TransactionID = 35, TransactionAmount - 500,
0
)
RETURN
ReturnAmount
Regards,
Harsh Nathani
Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 6 | |
| 6 | |
| 6 | |
| 5 | |
| 4 |