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
Anonymous
Not applicable

Count how many values have changed between Yesterday and Today

Good day,

 

I do have below scenario (example)

 

I would like track ONLY changes compare to prior day (BusinessDate). 

 

Customer Table

CustomerNameCustomerId
A1
B2
C3

 

Review Table

CustomerIdBusinessDate  ReviewDate
116-Jun-1924-Jan-18
117-Jun-1925-Jan-19
216-Jun-1919-May-18
217-Jun-1919-May-18
316-Jun-1922-Feb-18
317-Jun-1922-Feb-18

 

For CustomerId = 1, the ReviewDate has changed on the BusinessDate 17-Jun-2019 from 24-Jan-2018 to 25-Jan-2019.  And the rest of the customers information have not changed. So, it should show " 1 ' (because there is only one change).

When user selects the date (17-Jun-2019) from the Date slicer, Table / visual should only show " 1 ".

When user selects the date 16-Jun-2019 from the Date slicer, it should show " 0 " since the information has not changed.

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Anonymous ,

You can try to use following measure to achieve your requirement:

Measure =
VAR selected =
    MAX ( Calendar[Date] )
VAR reviewCount =
    CALCULATE (
        COUNTROWS ( Table ),
        FILTER ( ALLSELECTED ( Table ), [BusinessDate] <= selected ),
        VALUES ( Table[CustomerId] )
    )
RETURN
    IF ( reviewCouint >= 1, reviewCount-1 )

Notice: calendar is the source of slicer, please break relationships between current table and calendar table to ignore 'auto exist' filter.

Understanding DAX Auto-Exist

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Anonymous
Not applicable

Thank you so much Sheng.

 

I have tried your DAX but did not work for my requirement (I may be missing something).

 

Herewith the DAX:

 

Measure =
VAR selected =
MAX ( Calendar[Date] )
VAR reviewCount =
CALCULATE (
COUNTROWS ( 'Review Date' ),
FILTER ( ALLSELECTED ( 'Review Date' ), [BusinessDate] <= selected ),
VALUES ( 'Review Date'[CustomerId] )
)
RETURN
IF ( reviewCount >= 1, reviewCount-1 )

 

My simple model:

 

Model1.PNG

 

Sample Data:

Model.PNG

 

My Report layer:

 

Model2.PNG

 

Here in the Measure I am expecting: 2, because when I choose 06/17/2019 from the Date slicer ( compare BusinessDates between 6/16/2019 and  6/17/2019 (Date slicer)) , there are 2 ReviewDates have changed.

Model3.PNG

 

 

When I choose 06/18/2019 from the Date slicer, in the Measure I am expecting: 2, because  ( compare BusinessDates between 6/17/2019 and  6/18/2019 (Date slicer)) , there are 2 ReviewDates have changed. Here is screenshot:

Model4.PNG

 

I hope i explained it properly and you can understand my requirement.

 

Thank you

 

 

Hi @Anonymous ,

You can try to use following measure formula to find out changed records:

Measure =
VAR currDate =
    MAX ( 'Calendar'[Date] )
RETURN
    COUNTROWS (
        FILTER (
            SUMMARIZE (
                FILTER (
                    ALLSELECTED ( T1 ),
                    [BusinessDate] <= currDate
                        && [BusinessDate] >= currDate - 1
                ),
                [CustomerId],
                "DC Review", COUNTROWS ( VALUES ( T1[ReviewDate] ) )
            ),
            [DC Review] > 1
        )
    )

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help 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.