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
pagliaci
Frequent Visitor

Reference a row in another column

Hello, I hve two columns in the same table, onde of them is the index one, I want to reference the id number of that index, for example:

 

ID                         INDEX

8027890                   1

9809887                   2 

2938878                   3

 

What I need is to find out if an ID was entered twice, so I need 

If the ((ID of index 1)-(ID of index -1))=0, "SAME ID", "DIFFERENT ID"

 

How do I make this reference tho?

 

Thank a lot!!

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @pagliaci 

According to your description, I can clearly understand your requirement, you can try to create a calculated column like this:

Column =

var _lastID=CALCULATE(MAX('Table'[ID]),FILTER(ALL('Table'),[INDEX]=EARLIER('Table'[INDEX])-1))

return

IF([ID]=_lastID,"SAME ID","DIFFERENT ID")

 

And you can get what you want, like this:

vrobertqmsft_0-1635491805741.png

 

You can download my test pbix file below

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-robertq-msft
Community Support
Community Support

Hi, @pagliaci 

According to your description, I can clearly understand your requirement, you can try to create a calculated column like this:

Column =

var _lastID=CALCULATE(MAX('Table'[ID]),FILTER(ALL('Table'),[INDEX]=EARLIER('Table'[INDEX])-1))

return

IF([ID]=_lastID,"SAME ID","DIFFERENT ID")

 

And you can get what you want, like this:

vrobertqmsft_0-1635491805741.png

 

You can download my test pbix file below

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Jos_Woolley
Solution Sage
Solution Sage

Hi,

Calculated Column:

 

Duplicate? =
VAR MyID = 'Table'[ID]
VAR MyIDCount =
    CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', 'Table'[ID] = MyID ) )
RETURN
    IF ( MyIDCount > 1, "Duplicate" )

 

Regards

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.

Top Solution Authors