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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
GA1993
Helper II
Helper II

Data rolling over to next year if status not completed

Hi,

 

I would like to display the Rate values as displayed on the Expectation tables where December 20 2022 rolls over as status was not completed. My code, however, displays the table with the Actual results below.

 

Weirdly, data rolls over if it is on the same year (eg below November to December) but it doesn't for December 2022 to January 2023.

 

Expectation:

DateTarget CompletionKPIRate
22-NovDecember 15 20221100%
22-NovDecember 15 20221 
22-NovDecember 20 2022    1 
22-DecDecember 20 2022050%
22-DecJanuary 21 20221 
23-JanDecember 20 202200%

 

Actual:

DateTarget CompletionKPIRate
22-NovDecember 15 20221100%
22-NovDecember 15 20221 
22-NovDecember 20 2022    1 
22-DecDecember 20 2022050%
22-DecJanuary 21 20221 
23-Janblank1100%

 

 

 

 

 

CALCULATE 
  (
   COUNTROWS('MP005 (Time to Hire)'),
   FILTER('MP005 (Time to Hire)',
   'MP005 (Time to Hire)'[Target Completion]>='MP - Engine'[Date]
    && 'MP005 (Time to Hire)'[Target Completion]<=EOMONTH('MP - Engine'[Date],0)
    && 'MP005 (Time to Hire)'[KPI]=1)                
   )
/ (
(CALCULATE
  (
   COUNTROWS('MP005 (Time to Hire)'),
    FILTER('MP005 (Time to Hire)',
    'MP005 (Time to Hire)'[Target Completion]>='MP - Engine'[Date]
     && 'MP005 (Time to Hire)'[Target Completion]<=EOMONTH('MP - Engine'[Date],0)
     && 'MP005 (Time to Hire)'[KPI]=1)                                    
   )
) + 
(CALCULATE
 (
    COUNTROWS('MP005 (Time to Hire)'),
    FILTER('MP005 (Time to Hire)',
    'MP005 (Time to Hire)'[Target Completion]>='MP - Engine'[Date]
     && 'MP005 (Time to Hire)'[Target Completion]<=EOMONTH('MP - Engine'[Date],0)
     && 'MP005 (Time to Hire)'[KPI]=0)                                    
 )
)   
)

 

 

 

 

 

Can someone help me please? Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @GA1993,

I think the EOMonth function may not suitable for the cross year calculation, you can try to use the following dax formula if it helps:

 

formula =
CALCULATE (
    DIVIDE (
        CALCULATE (
            COUNTROWS ( 'MP005 (Time to Hire)' ),
            'MP005 (Time to Hire)'[KPI] = 1
        ),
        CALCULATE (
            COUNTROWS ( 'MP005 (Time to Hire)' ),
            'MP005 (Time to Hire)'[KPI] IN { 0, 1 }
        )
    ),
    FILTER (
        'MP005 (Time to Hire)',
        'MP005 (Time to Hire)'[Target Completion] >= 'MP - Engine'[Date]
            && 'MP005 (Time to Hire)'[Target Completion]
                <= DATE ( YEAR ( 'MP - Engine'[Date] ), MONTH ( 'MP - Engine'[Date] ) + 1, 1 ) - 1
    )
)

 

Regards,

Xiaoxin Sheng

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @GA1993,

I think the EOMonth function may not suitable for the cross year calculation, you can try to use the following dax formula if it helps:

 

formula =
CALCULATE (
    DIVIDE (
        CALCULATE (
            COUNTROWS ( 'MP005 (Time to Hire)' ),
            'MP005 (Time to Hire)'[KPI] = 1
        ),
        CALCULATE (
            COUNTROWS ( 'MP005 (Time to Hire)' ),
            'MP005 (Time to Hire)'[KPI] IN { 0, 1 }
        )
    ),
    FILTER (
        'MP005 (Time to Hire)',
        'MP005 (Time to Hire)'[Target Completion] >= 'MP - Engine'[Date]
            && 'MP005 (Time to Hire)'[Target Completion]
                <= DATE ( YEAR ( 'MP - Engine'[Date] ), MONTH ( 'MP - Engine'[Date] ) + 1, 1 ) - 1
    )
)

 

Regards,

Xiaoxin Sheng

Thanks for the reply.

 

I wanted to know more about your code what does the following mean?

MONTH ( 'MP - Engine'[Date] ) + 1, 1 ) - 1

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.