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
raksone
Frequent Visitor

Retrieve the max date among the preceding dates if the time difference in months is one

Hello everyone,

I'm currently facing an issue with a code that aims to find the maximum date among the consecutive preceding dates. Specifically, I want to retrieve the max date if the time difference in months between the current row and the previous row is exactly one. Unfortunately, I haven't been able to achieve the expected result despite my efforts.

It is important to note that sometimes there are two charges within the same month, with the same charge type and same tenant that I would like to count as one for this purpose.

I would greatly appreciate it if someone from the community could assist me with this matter. Thank you in advance for your help!

This is my code:

 

=
MAXX(
    FILTER(
        ALL('rx_Tenant_Unpaid_Charges'),
        'rx_Tenant_Unpaid_Charges'[Tenant Code] = EARLIER('rx_Tenant_Unpaid_Charges'[Tenant Code])
            && 'rx_Tenant_Unpaid_Charges'[Charge Type] = EARLIER('rx_Tenant_Unpaid_Charges'[Charge Type])
            && rx_Tenant_Unpaid_Charges[Charge Type] = "HAPRent"
    ),
     IF (  'rx_Tenant_Unpaid_Charges'[PreviousDate] - EOMONTH(EARLIER('rx_Tenant_Unpaid_Charges'[PreviousDate]), 0) <= 1, 'rx_Tenant_Unpaid_Charges'[PreviousDate], BLANK() )
)

 

This is the result:
raksone_0-1683821465401.png

This is the expected result:

raksone_1-1683821807441.png

 

1 REPLY 1
raksone
Frequent Visitor

Hello guy s, does anyone have an idea?

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.

Top Solution Authors