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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Anonymous
Not applicable

Merge and duplicate flag in powerbi

I have a report that gets updated on a monthly basis in power biwhich determines how many issues have been repeated, how many are new and how many are closed. Currently since multiple conditions needs to be considered prior to figuring out if the issue has been repeated or not. So I used the Merged option to get one column. 

 

In the example below. It shows that row 1 is repeated in row 5(note that only the month has changed) so it means this is an existing issue, Rows 3 and 4 were not present in Sep meaning they are new issues. Row 2 is not repeated in Oct month meaning the issue was resolved.

 

How can I do this for 1000+ rows, please help

 

Column1Column2Column3Column4Column5Column6MergedStatus
ABCSep2010.15.234.123CriticalThe port is not reachableABC,20,10.15.234.123,Critical,The port is not reachableExisting issue
DEFSep4510.22.235.245NoneThe device is downDEF,45,10.22.235.245,None,The device is downClosed issue
GEFOct6711.234.25.56HighAccess deniedGEF,67,11.234.25.56,High,Access deniedNew issue
HIGOct84510.65.34.265MediumIssue with the knobHIG,845,10.65.34.265,Medium,Issue with the knobNew Issue
ABCOct2012.15.234.123CriticalThe port is not reachableABC,20,10.15.234.123,Critical,The port is not reachableExisting issue
1 ACCEPTED SOLUTION
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

You need to build a Month Table relate two tables between month column and column2.

Month Table:

1.png

Add a MonthNo column in Fact Table.

MonthNo = RELATED('Month'[MonthNo])

2.png

Then build Flag column.

Flag = 
VAR _Count =
    COUNTAX (
        FILTER ( 'Table', 'Table'[Merged] = EARLIER ( 'Table'[Merged] ) ),
        'Table'[Merged]
    )
VAR _MaxMonthNo =
    MAX ( 'Table'[MonthNo] )
VAR _MaxMonthNoPerMerge =
    MAXX (
        FILTER ( 'Table', 'Table'[Merged] = EARLIER ( 'Table'[Merged] ) ),
        'Table'[MonthNo]
    )
RETURN
    IF (
        _Count = 1
            && _MaxMonthNoPerMerge = _MaxMonthNo,
        "New Issue",
        IF ( _MaxMonthNoPerMerge = _MaxMonthNo, "Existing issue", "Closed issue" )
    )

Result is as below.

3.png

You can download my pbix file from this link: File

 

Best Regards,

Rico Zhou

 

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-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

You need to build a Month Table relate two tables between month column and column2.

Month Table:

1.png

Add a MonthNo column in Fact Table.

MonthNo = RELATED('Month'[MonthNo])

2.png

Then build Flag column.

Flag = 
VAR _Count =
    COUNTAX (
        FILTER ( 'Table', 'Table'[Merged] = EARLIER ( 'Table'[Merged] ) ),
        'Table'[Merged]
    )
VAR _MaxMonthNo =
    MAX ( 'Table'[MonthNo] )
VAR _MaxMonthNoPerMerge =
    MAXX (
        FILTER ( 'Table', 'Table'[Merged] = EARLIER ( 'Table'[Merged] ) ),
        'Table'[MonthNo]
    )
RETURN
    IF (
        _Count = 1
            && _MaxMonthNoPerMerge = _MaxMonthNo,
        "New Issue",
        IF ( _MaxMonthNoPerMerge = _MaxMonthNo, "Existing issue", "Closed issue" )
    )

Result is as below.

3.png

You can download my pbix file from this link: File

 

Best Regards,

Rico Zhou

 

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

amitchandak
Super User
Super User

@Anonymous , Not very clear.

Try a new column


new column =
if(isblank(countx(filter(Table, [Column1] = earlier([Column1]) && [Column2] <earlier([Column2])),[Column1])), "New Issue", "Existing issue")

 

Column2 need to be a date column or month order

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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