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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
snifer
Post Patron
Post Patron

help for chekc if colum are conrelated

idreference amountresultmatch
100 milan150150no
101 italy520520no
10210050150-50=100102-100
103101100520-100=420103-101
104 france200200 no

 

in my table, I have a reference column and an Id column I need to check if the reference number match any id in other all row, and if in the match subtract the column result as shown above

and create a new column where is written what match was find

it will be nicer to create a new table with just the positive match

 

10210050150-50=100102-100
103101100520-100=420103-101
1 ACCEPTED SOLUTION

@snifer

 

Change it to following

 

Result_ =
VAR check =
    CONTAINS ( Table1, [id], [reference] )
VAR answer =
    IF (
        check,
        LOOKUPVALUE ( Table1[ amount], [id], [reference] ) - [ amount],
        [ amount]
    )
RETURN
    IF ( check, [reference] & "-" & [ amount] & "=" & answer, [ amount] & "" )

Regards
Zubair

Please try my custom visuals

View solution in original post

6 REPLIES 6
Zubair_Muhammad
Community Champion
Community Champion

@snifer

 

Try these calc columns. Then you can easily filter them using "no match" criterio

See file attached as well

 

Result_ =
VAR check =
    CONTAINS ( Table1, [id], [reference] )
RETURN
    IF (
        check,
        LOOKUPVALUE ( Table1[ amount], [id], [reference] ) - [ amount],
        [ amount]
    )
Match_ =
VAR check =
    CONTAINS ( Table1, [id], [reference] )
RETURN
    IF ( check, [id] & "-" & [reference], "no" )

 sbifer.png

 


Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad

 

I got an error when I create first column since the column reference is a txt column( if i try to convert in number i get error)

 

there any way to filter out text or change the column in integer number without errors?

Capture.PNG

@snifer

 

Could you change your ID column to text type?

Then this formula will work

 


Regards
Zubair

Please try my custom visuals

yes now it is working,

 

only thing it is missing it to show both of the value on the result

Capture.PNG meaning now i go te Result_ but i dont see how result it came

i need to display the value from id( this is simply, just drag the amount  of the  id) but the problem it is to display the amount of the reference

@snifer

 

Change it to following

 

Result_ =
VAR check =
    CONTAINS ( Table1, [id], [reference] )
VAR answer =
    IF (
        check,
        LOOKUPVALUE ( Table1[ amount], [id], [reference] ) - [ amount],
        [ amount]
    )
RETURN
    IF ( check, [reference] & "-" & [ amount] & "=" & answer, [ amount] & "" )

Regards
Zubair

Please try my custom visuals

Capture.PNG@Zubair_Muhammad

 

the calculation is working but instead of report the amount of the id for example here 52080 it is writing 52080

can be fixed to show instead of the id the amount connect to this id?

the calculation working fine it take in consideration the amount

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.