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

How to calculate the number of time a date has changed for a certain record

Hi Guys, I need some help and the steps I would need to follow to get this calculation.

 

I have data that looks like this 

 

trackeridenddate
1202025/09/30 00:00
1572025/07/31 00:00
1572025/08/31 00:00
1652025/07/31 00:00
1672025/07/31 00:00
1682025/07/31 00:00
1692025/04/30 00:00
1712025/07/31 00:00
1722025/07/25 00:00
1722025/08/31 00:00
1752025/07/18 00:00
1762025/09/11 00:00
1782025/04/30 00:00
1782025/08/31 00:00

 

What I want to do is to calculate the number of time the enddate has changes for that specific trackerid. Can anyone help?

1 ACCEPTED SOLUTION

Remove the end date from the visual, otherwise you get zero because every couple ID and date has only 1 value (- 1 = 0)

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

View solution in original post

7 REPLIES 7
danextian
Super User
Super User

Hi @iKettle 

You did not provide the expected result but assuming the current date <> to the previous date for the specific tracker id is a change, try this:

check = 
VAR currentDate = 'Table'[enddate]
VAR trackerID = 'Table'[trackerid]
VAR prevDate =
    MAXX (
        FILTER (
            'Table',
            'Table'[trackerid] = trackerID
                && 'Table'[enddate] < currentDate
        ),
        [enddate]
    )
RETURN
    IF ( NOT ( ISBLANK ( prevDate ) ) && currentDate <> prevDate, 1 )

This also assumes that if there's no date before current, it isn't a change.

danextian_0-1754567757909.png

 

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

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


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thanks. But where do I place this formula in - as a new measure or in dax - I just need that explained. 

FBergamaschi
Solution Sage
Solution Sage

You can create a measure

Numero of variations=

DISTINCTCOUNT (Table[end date]) -1

 

Then put the track id in rows and the above measure in values

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

Thank you, I tried that. So I added a new measure and used this formula;

DISTINCTCOUNT (Table[end date]) -1

 

But it gives me 0, even though I should have at least 1 for some of the ID.....

Can you show an image?

iKettle_1-1754574798897.png

 

Remove the end date from the visual, otherwise you get zero because every couple ID and date has only 1 value (- 1 = 0)

 

If this helped, please consider giving kudos and mark as a solution

@me in replies or I'll lose your thread

Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

Consider voting this Power BI idea

Francesco Bergamaschi

MBA, M.Eng, M.Econ, Professor of BI

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