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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
SvenVa
Regular Visitor

Neem some help with EARLIER function

Hi all,

 

I'm working on a visual to see the decrease in the gap between renewal times of education signups. 

An account can have signups for multiple education. I want to see the difference in days between signups of the same education type for the same account.

This is some example data:

 

HbRMjnH

 

This is the function I am trying to use:

 

DaysBetweenEduSignUps = DATEDIFF(EducationAgreements[Start date];filter(EducationAgreements;EARLIER(EducationAgreements[Start date]));DAY)

I'm pretty sure this is not the complete formula and it also gives this error: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

 

I'm struggeling with this function and also how I should like it to the same education type and account. 

 

Can anyone help me out?

1 ACCEPTED SOLUTION
v-frfei-msft
Community Support
Community Support

Hi @SvenVa ,

 

One sample for your reference. Please check the following steps as below.

 

1. Create an index column by education column.

index = 
RANKX (
    FILTER ( Table1, Table1[Education] = EARLIER ( Table1[Education] ) ),
    'Table1'[Start date],
    ,
    DESC,
    DENSE
)

2. Create the target column we need.

 

Days = 
VAR index = Table1[index] - 1
VAR eardate =
    CALCULATE (
        MAX ( 'Table1'[Start date] ),
        FILTER (
            Table1,
            Table1[index] = index
                && 'Table1'[Education] = EARLIER ( 'Table1'[Education] )
        )
    )
RETURN
    IF (
        ISBLANK ( eardate ),
        BLANK (),
        DATEDIFF ( Table1[Start date], eardate, DAY )
    )

Capture.PNG

 

 

 

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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Write this calculated column formula

Diff = [End Date]-[Start Date]

To your visual, drag Account Name and Education fields.  Write this measure

Total diff = SUM(Data[Diff])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-frfei-msft
Community Support
Community Support

Hi @SvenVa ,

 

One sample for your reference. Please check the following steps as below.

 

1. Create an index column by education column.

index = 
RANKX (
    FILTER ( Table1, Table1[Education] = EARLIER ( Table1[Education] ) ),
    'Table1'[Start date],
    ,
    DESC,
    DENSE
)

2. Create the target column we need.

 

Days = 
VAR index = Table1[index] - 1
VAR eardate =
    CALCULATE (
        MAX ( 'Table1'[Start date] ),
        FILTER (
            Table1,
            Table1[index] = index
                && 'Table1'[Education] = EARLIER ( 'Table1'[Education] )
        )
    )
RETURN
    IF (
        ISBLANK ( eardate ),
        BLANK (),
        DATEDIFF ( Table1[Start date], eardate, DAY )
    )

Capture.PNG

 

 

 

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

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors