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
aditya369_
New Member

please help me with below scenario, need to compare ID's with previous date

Hi Team,

Good evening. Need help to get the expected output.i am attaching excel file, in that having two columns

1. Date and Invoice ID

2. I have given expected output column

 

Note: we need to compare invoice ID's with previous date, if it is not matching then "New" else if matches then "OLD". i tried different ways but unable get that.please help me.

 

please find the attached image for your reference.Scenario.jpg

 

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

Hi @aditya369_ ,

Please try below steps:

1. add a index column in Power Query Pane

vbinbinyumsft_0-1682647018148.png

2. create a measure with below dax formula

Measure =
VAR _idx =
    SELECTEDVALUE ( 'Table'[Index] )
VAR _id =
    SELECTEDVALUE ( 'Table'[Invoice ID] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), [Index] < _idx )
VAR _str =
    CONCATENATEX ( tmp, [Invoice ID], "," )
VAR _val =
    CONTAINSSTRING ( _str, _id )
RETURN
    IF ( _val, "Old", "New" )

3. add a table visual with fileds and measure

vbinbinyumsft_1-1682647110548.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
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

1 REPLY 1
v-binbinyu-msft
Community Support
Community Support

Hi @aditya369_ ,

Please try below steps:

1. add a index column in Power Query Pane

vbinbinyumsft_0-1682647018148.png

2. create a measure with below dax formula

Measure =
VAR _idx =
    SELECTEDVALUE ( 'Table'[Index] )
VAR _id =
    SELECTEDVALUE ( 'Table'[Invoice ID] )
VAR tmp =
    FILTER ( ALL ( 'Table' ), [Index] < _idx )
VAR _str =
    CONCATENATEX ( tmp, [Invoice ID], "," )
VAR _val =
    CONTAINSSTRING ( _str, _id )
RETURN
    IF ( _val, "Old", "New" )

3. add a table visual with fileds and measure

vbinbinyumsft_1-1682647110548.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.