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
GJUDGE
Helper II
Helper II

Changes in Date MoM

Hi,

 

I have a set of projects where the project status and key dates is reported each month. I am trying to write a measure that will quickly show the projects who have had date changes between the latest month reporting period and the one previously. In the example below, project A has had a change in construciton date moving from Aug-Sept and project C has had a change in commissioning date.

Will I need to write a measure for each Date that I am interested in? I'm also keen that this can  be dynmaic as possible so that when a new month is added the measure still compares the latest reporting month to the previous month.

 

Thanks in advance!

 

ProjectOutputConstruction Start DateCommissioning DateReporting Period
A5001/01/202301/06/2023Aug-21
B2501/04/202307/04/2023Aug-21
C5001/05/202301/07/2023Aug-21
A5001/02/202301/06/2023Sep-21
B2501/04/202307/04/2023Sep-21
C5001/05/202301/06/2023Sep-21
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @GJUDGE ,

 

Depending on how you are making the filter of the month but in this case I have added a disconnected table for the filtering of the month of reporting and did the following measure:

 

Has Changes = 
IF (
    COUNTROWS (
        SUMMARIZE (
            FILTER (
                'Table',
                'Table'[Reporting Period] <= MAX ( 'Calendar'[Date] )
                    && 'Table'[Reporting Period]
                        >= DATE ( YEAR ( MIN ( 'Calendar'[Date] ) - 1 ), MONTH ( MIN ( 'Calendar'[Date] ) - 1 ), 1 )
            ),
            'Table'[Project],
            'Table'[Commissioning Date],
            'Table'[Construction Start Date]
        )
    ) > 1,
    "Project has changes"
)

 

Final result below

MFelix_0-1634807506744.png

Check PBIX file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

3 REPLIES 3
MFelix
Super User
Super User

Hi @GJUDGE ,

 

I was thinnking about the issue and you can use this measure to reflect what is changing in a single measure:

Has Date Changes = 
VAR TEmpTable =
    SUMMARIZE (
        FILTER (
            'Table',
            'Table'[Reporting Period] <= MAX ( 'Calendar'[Date] )
                && 'Table'[Reporting Period]
                    >= DATE ( YEAR ( MIN ( 'Calendar'[Date] ) - 1 ), MONTH ( MIN ( 'Calendar'[Date] ) - 1 ), 1 )
        ),
        'Table'[Project],
        "Commissioning", DISTINCTCOUNT ( 'Table'[Commissioning Date] ),
        "Starting Date", DISTINCTCOUNT ( 'Table'[Construction Start Date] )
    )
VAR Comissiningdate =
    IF (
        COUNTROWS ( FILTER ( TEmpTable, [Commissioning] > 1 ) ) > 0,
        "Change in commission date"
    )
VAR StartDate =
    IF (
        COUNTROWS ( FILTER ( TEmpTable, [Starting Date] > 1 ) ) > 0,
        "Change in Starting date"
    )
RETURN
    Comissiningdate
        & IF (
            OR ( ISBLANK ( Comissiningdate ), ISBLANK ( StartDate ) ),
            BLANK (),
            " | "
        ) & StartDate

 

MFelix_0-1634890259072.png

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



v-zhangti
Community Support
Community Support

Hi, GJUDGE

You can try the following methods:

  1. I wrote two  measures for these two dates. Please understand that CSD changes represents construction start date changes and CD changes represents commissioning date changes.
CSD changes =
IF (
    CALCULATE (
        MIN ( 'Table'[Construction Start Date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Project] = SELECTEDVALUE ( 'Table'[Project] )
        )
    )
        = SELECTEDVALUE ( 'Table'[Construction Start Date] ),
    BLANK (),
    SELECTEDVALUE ( 'Table'[Project] )
)
CD changes =
IF (
    CALCULATE (
        MIN ( 'Table'[Commissioning Date] ),
        FILTER (
            ALLSELECTED ( 'Table' ),
            'Table'[Project] = SELECTEDVALUE ( 'Table'[Project] )
        )
    )
        = SELECTEDVALUE ( 'Table'[Commissioning Date] ),
    BLANK (),
    SELECTEDVALUE ( 'Table'[Project] )
)

2.The output results of the two measures are shown in the figure:

vzhangti_0-1634869211885.png

 

Best Regards,

Charlotte Zhang

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

 

MFelix
Super User
Super User

Hi @GJUDGE ,

 

Depending on how you are making the filter of the month but in this case I have added a disconnected table for the filtering of the month of reporting and did the following measure:

 

Has Changes = 
IF (
    COUNTROWS (
        SUMMARIZE (
            FILTER (
                'Table',
                'Table'[Reporting Period] <= MAX ( 'Calendar'[Date] )
                    && 'Table'[Reporting Period]
                        >= DATE ( YEAR ( MIN ( 'Calendar'[Date] ) - 1 ), MONTH ( MIN ( 'Calendar'[Date] ) - 1 ), 1 )
            ),
            'Table'[Project],
            'Table'[Commissioning Date],
            'Table'[Construction Start Date]
        )
    ) > 1,
    "Project has changes"
)

 

Final result below

MFelix_0-1634807506744.png

Check PBIX file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.