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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Easley08
Helper I
Helper I

Adding 1st 2nd 3rd and 3rdyearmore based on start date

Hi,

 

is there a way to get the Anniv Year based on start date of this client 

to get the tagging of ( 1st year , 2nd year , 3rd year )

Easley08_0-1700707803947.png

 

 

Thanks.

 

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your semantic model.

 

Jihwan_Kim_0-1700713444243.png

 

INDEX function (DAX) - DAX | Microsoft Learn

 

Tag CC = 
VAR _startdate =
    MAXX (
        INDEX (
            1,
            SUMMARIZE ( Data, Data[Client], Data[Report_date] ),
            ORDERBY ( Data[Report_date], ASC ),
            ,
            PARTITIONBY ( Data[Client] )
        ),
        Data[Report_date]
    )
RETURN
    IF ( Data[Report_date] = _startdate, "New", "Existing" )
Anniversary year CC =
VAR _startdate =
    MAXX (
        INDEX (
            1,
            SUMMARIZE ( Data, Data[Client], Data[Report_date] ),
            ORDERBY ( Data[Report_date], ASC ),
            ,
            PARTITIONBY ( Data[Client] )
        ),
        Data[Report_date]
    )
VAR _currentrowdate = Data[Report_date]
VAR _diff =
    DATEDIFF ( _startdate, _currentrowdate, DAY ) / 365
RETURN
    IF ( Data[Report_date] = _startdate, 1, ROUNDUP ( _diff, 0 ) )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your semantic model.

 

Jihwan_Kim_0-1700713444243.png

 

INDEX function (DAX) - DAX | Microsoft Learn

 

Tag CC = 
VAR _startdate =
    MAXX (
        INDEX (
            1,
            SUMMARIZE ( Data, Data[Client], Data[Report_date] ),
            ORDERBY ( Data[Report_date], ASC ),
            ,
            PARTITIONBY ( Data[Client] )
        ),
        Data[Report_date]
    )
RETURN
    IF ( Data[Report_date] = _startdate, "New", "Existing" )
Anniversary year CC =
VAR _startdate =
    MAXX (
        INDEX (
            1,
            SUMMARIZE ( Data, Data[Client], Data[Report_date] ),
            ORDERBY ( Data[Report_date], ASC ),
            ,
            PARTITIONBY ( Data[Client] )
        ),
        Data[Report_date]
    )
VAR _currentrowdate = Data[Report_date]
VAR _diff =
    DATEDIFF ( _startdate, _currentrowdate, DAY ) / 365
RETURN
    IF ( Data[Report_date] = _startdate, 1, ROUNDUP ( _diff, 0 ) )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Hi this is really helpful but i will try to implement this into SSAS Cube dax since im in live connection 

but the logic is in there this is amazing how you get this. my mind is exploding right on how you did this thanks a lot sir! 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.