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

How to create a calculated columns with date - the nearest date of occurrence

Hi, is it possible to create a calculated column with the date of the next occurrence of the value according to the picture below?

Thank you
 
 

image.png

 

 

 

2 ACCEPTED SOLUTIONS
mahoneypat
Employee
Employee

Please try this column expression

 

Next Date =
VAR vThisDate = Table[Date]
VAR vNextDate =
    CALCULATE (
        MIN ( Table[Date] ),
        ALLEXCEPT (
            Table,
            Table[Value]
        ),
        Table[Date] > vThisDate
    )
RETURN
    vNextDate

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

Fiala
Helper II
Helper II

@mahoneypat works great, thank you very much 🙂

View solution in original post

3 REPLIES 3
Fiala
Helper II
Helper II

Hellou @mahoneypat @, can you please help me again? I need almost the same. but I need to create a measure instead of calculated column. I need to find out the nearest date of occurence

I create a virtual table CD_MSISDN = value):

 

var t1 = ADDCOLUMNS(GROUPBY(Query1,Query1[value],Query1[TS_ENTERED_QUEUE]),"next contact",next_date)

looks like:
Fiala_2-1644711352614.png

 

I don´t know how to create Next contact column.

Thank you

 


Fiala
Helper II
Helper II

@mahoneypat works great, thank you very much 🙂

mahoneypat
Employee
Employee

Please try this column expression

 

Next Date =
VAR vThisDate = Table[Date]
VAR vNextDate =
    CALCULATE (
        MIN ( Table[Date] ),
        ALLEXCEPT (
            Table,
            Table[Value]
        ),
        Table[Date] > vThisDate
    )
RETURN
    vNextDate

 

Pat

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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