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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
nhol
Advocate II
Advocate II

Compare and alert when data got changed

Hi,

 

I need a solution for the following query:

 

I have a daily dataset that on a regular basis don't change at all, however when the percentage of "CapitalPercent" between days are changing I want it to be flagged somehow. I was thinking about creating a measure that will check the daily dataset and compare it to the day before and if something got changed then it will notify the user.

 

Any idea how this can be done?

 

Thanks!

NH

 

Stock.PNG

6 REPLIES 6
v-jiascu-msft
Employee
Employee

Hi @nhol,

 

Maybe you can try something like this: adding an arrow when the data changes.

 

If you want the exact formula, please provide your pbix file or a sample.

Measure 2 =
VAR lastdayQuantity =
    CALCULATE (
        SUM ( FactSales[SalesQuantity] ),
        PREVIOUSDAY ( 'DimDate'[Datekey] )
    )
VAR sumQuantity =
    SUM ( FactSales[SalesQuantity] )
RETURN
    IF (
        lastdayQuantity > sumQuantity,
        CONCATENATE ( sumQuantity, UNICHAR ( 9660 ) ),
        IF (
            lastdayQuantity = sumQuantity,
            sumQuantity,
            CONCATENATE ( sumQuantity, UNICHAR ( 9650 ) )
        )
    )

Compare_and_alert_when_data_got_changed

 

 

Best Regards,

Dale

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

Hi Dale and thanks for your assistance.

This worked just fine until I realized I don't have sequential dates as you can see from the picture attached (marked in yellow).

The other challenge I'm having is that I'm using DirectQuery mode so any option of using a calculated column on the fly won't work here.

 

stock capture.PNG

Thanks!

NH

Hi Dale,

 

Did you have a chance to look at my last query regarding my DAX challenge.

Your solution was perfect and served exactly what I've needed but there is a small issue with non sequential dates (skipping weekends). Any idea how to resolve this?

 

Thanks!

NH

Hi @nhol,

 

If your mode is Direct Query to SQL Server, you can add a measure. You can make a little change to apply this measure to the non sequential dates.

Measure =
VAR lastdayQuantity =
    CALCULATE (
        SUM ( FactSales[SalesQuantity] ),
        PREVIOUSDAY ( 'DimDate'[Datekey] )
    )
VAR sumQuantity =
    SUM ( FactSales[SalesQuantity] )
RETURN
    IF (
        ISBLANK ( lastdayQuantity ),
        sumQuantity,
        IF (
            lastdayQuantity > sumQuantity,
            CONCATENATE ( sumQuantity, UNICHAR ( 9660 ) ),
            IF (
                lastdayQuantity = sumQuantity,
                sumQuantity,
                CONCATENATE ( sumQuantity, UNICHAR ( 9650 ) )
            )
        )
    )

Best Regards,

Dale

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

The tweak you've suggested resulted in that if previousday of a specific date is BLANK then provide the VAR sumQuantity. However, this is not really the case. When the previousday is blank you need to compare the value to the last value that was given and look for a change there.

You suggestion is a good start to facilitate the requirement but is not complete.

 

If further info is needed I can provid it to you.

 

Best,

NH

Hi @nhol,

 

The formula I posted is just a demo. You need to make some changes. Please share you pbix file if you can.

 

Best Regards,

Dale

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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