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
Sachy123
Helper V
Helper V

Check History (new or deleted records)

so I have the following data set                                                      (Happy new Year to everyone BTW 😊)

 

ReportDateRecord IDUpdateDateColumn AColumn B
31st December 2020120/12/2020 8:00:001080
31st December 2020215/12/2020 10:30:008800
31st December 2020401/12/2020 8:00:004432
30th November 2020129/11/2020 10:30:001080
30th November 2020226/11/2020 14:00:334467
30th November 2020315/11/2020 15:00:445020

 

I am planning to make a filter on Report date and show or highlight the records which have changed / updated or deleted.

 

Do we have a comparison like that? 

Like e.g.

if I select Report Date 31st December 2020

 

Then I should see all the records like as below

ReportDateRecord IDUpdateDateColumn AColumn B
31st December 2020120/12/2020 8:00:001080
31st December 2020215/12/2020 10:30:008800
31st December 2020401/12/2020 8:00:004432

 

Green = No Change

Red = Update

Blue = New

 

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

Hi @Sachy123 ,

 

The pbix file I tested is here.

 

1.Create the measure.

Measure =
VAR _date =
    SELECTEDVALUE ( 'Table'[ReportDate] )
VAR _pre =
    MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[ReportDate] < _date ), [ReportDate] )
VAR _a =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Record ID] = MAX ( 'Table'[Record ID] )
                && 'Table'[ReportDate] = _pre
        ),
        [Column A]
    )
VAR _b =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Record ID] = MAX ( 'Table'[Record ID] )
                && 'Table'[ReportDate] = _pre
        ),
        [Column B]
    )
RETURN
    IF (
        MAX ( 'Table'[Column A] ) = _a
            && MAX ( 'Table'[Column B] ) = _b,
        "Green",
        IF (
            _a = BLANK ()
                && _b = BLANK (),
            "Blue",
            IF ( MAX ( 'Table'[Column A] ) <> _a || MAX ( 'Table'[Column B] ) <> _b, "Red" )
        )
    )

 

2.In the visual, set the font color as follows.

11.png

12.png

 

 

 

Best Regards,

Stephen Tao

 

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

4 REPLIES 4
v-stephen-msft
Community Support
Community Support

Hi @Sachy123 ,

Could you tell me if your problem has been solved?
If it is, kindly Accept it as the solution. More people will benefit from it.
Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.


Best Regards,
Stephen Tao

v-stephen-msft
Community Support
Community Support

Hi @Sachy123 ,

 

The pbix file I tested is here.

 

1.Create the measure.

Measure =
VAR _date =
    SELECTEDVALUE ( 'Table'[ReportDate] )
VAR _pre =
    MAXX ( FILTER ( ALL ( 'Table' ), 'Table'[ReportDate] < _date ), [ReportDate] )
VAR _a =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Record ID] = MAX ( 'Table'[Record ID] )
                && 'Table'[ReportDate] = _pre
        ),
        [Column A]
    )
VAR _b =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Record ID] = MAX ( 'Table'[Record ID] )
                && 'Table'[ReportDate] = _pre
        ),
        [Column B]
    )
RETURN
    IF (
        MAX ( 'Table'[Column A] ) = _a
            && MAX ( 'Table'[Column B] ) = _b,
        "Green",
        IF (
            _a = BLANK ()
                && _b = BLANK (),
            "Blue",
            IF ( MAX ( 'Table'[Column A] ) <> _a || MAX ( 'Table'[Column B] ) <> _b, "Red" )
        )
    )

 

2.In the visual, set the font color as follows.

11.png

12.png

 

 

 

Best Regards,

Stephen Tao

 

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

@Sachy123 , Create a nea column like this

 

Color column =
var _max = filter(Table, [Record ID] =earlier([Record ID]) && [UpdateDate] <earlier([UpdateDate])),[UpdateDate])
var _valA = filter(Table, [Record ID] =earlier([Record ID]) && [UpdateDate] =_max),[Column A])
var _valB = filter(Table, [Record ID] =earlier([Record ID]) && [UpdateDate] =_max),[Column B])
return
Switch( True(),
isblank(_valA) , "New",
[Column A] =_valA && [Column B] = _valB , "No Change",
"Update"
)

 

Use this in conditional formatting for each column using "Field value" option use First or Last for Aggregation

 

https://radacad.com/dax-and-conditional-formatting-better-together-find-the-biggest-and-smallest-num...
https://docs.microsoft.com/en-us/power-bi/desktop-conditional-table-formatting#color-by-color-values

Hello @amitchandak 

Thanks, but I cannot use EARLIER function, 

it says "Parameter is not correct type" Cannot find the name "Record ID"

I have also linked the table to a time dimension.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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