Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
I am trying to figure out if there is any way to get the row values from one "Transaction Number" to a another "Transaction Number" in the same column.
For example, I have a transaction number that have som form of amount. Sometimes, there are transactions that have the identical number but start with a "C". The C stands for "Correction" and I would like to get the values from the ones that start with "C" and show the results in a measure but on the row with the corresponding number without a letter. Is this possible to do as measure?
Thank you 🙂
Solved! Go to Solution.
New Measure =
SUMX(
VALUES('Table'[Transaction Number]),
VAR _current_tr_num = 'Table'[Transaction Number]
VAR _correction = "C" & _current_tr_num
VAR _result = CALCULATE([Amount Measure],'Table'[Transaction Number] = _correction)
RETURN
_result
)
New Measure =
SUMX(
VALUES('Table'[Transaction Number]),
VAR _current_tr_num = 'Table'[Transaction Number]
VAR _correction = "C" & _current_tr_num
VAR _result = CALCULATE([Amount Measure],'Table'[Transaction Number] = _correction)
RETURN
_result
)
Thank you both for the quick replies. Unfortunately, I can’t get any of the codes to work since I misread my own data. The numbers are not identical, but the first 0 is replaced with a "C" e.g.
For your code @SpartaBI , I tried to alter the code like this (for the second variable):
"C" & LEFT(_current_tr_num,LEN(_current_tr_num)-1) .. But I might be getting the logic wrong.
And for your code @tamerj1 I couldn’t get "selectedvalue" to work (it was greyed out and not found by intellicense) so I replaced it with "hasonevalue", but the code is returning blanks.
I apologize in advance if the solution is simple. but I am a beginner in DAX.
hahaha it's amazing how the brain can fail you at times :')
thank you, worked like a charm!
please try
NewMeasure =
SUMX (
VALUES ( TableName[Transactio Number] ),
CALCULATE (
IF (
RIGHT ( SELECTEDVALUE ( TableName[Transactio Number] ), 1 ) <> "C",
CALCULATE (
[Amount],
FILTER (
ALL ( TableName ),
TableName[Transactio Number]
= "C" & SELECTEDVALUE ( TableName[Transactio Number] )
)
)
)
)
)
Thank you both for the quick replies. Unfortunately, I can’t get any of the codes to work since I misread my own data. The numbers are not identical, but the first 0 is replaced with a "C" e.g.
For your code @SpartaBI , I tried to alter the code like this (for the second variable):
"C" & LEFT(_current_tr_num,LEN(_current_tr_num)-1) .. But I might be getting the logic wrong.
And for your code @tamerj1 I couldn’t get "selectedvalue" to work (it was greyed out and not found by intellicense) so I replaced it with "hasonevalue", but the code is returning blanks.
I apologize in advance if the solution is simple. but I am a beginner in DAX.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 1 |
| User | Count |
|---|---|
| 21 | |
| 14 | |
| 11 | |
| 6 | |
| 5 |