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
alevandenes
Helper IV
Helper IV

combination of ID and date for IF function

Hi community,

 

i want to add a column that states "consider" when the date is MAX(date) for a specific ID.

for the dates that are not MAX, it would state "dont consider"

 

alevandenes_0-1664522975033.png

i manage to go until here, but i do not know how to count for the ID as well:
Consider = if('Project1'[Date]=MAX('Project1'[Date]), "consider", "dont consider")
 
thanks a lot in advance,
Alessandra
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your table looks like, but could you please try the below calculated column formula?

 

Consider CC =
VAR _maxdate =
    MAXX (
        FILTER ( 'Project1', 'Project1'[ID] = EARLIER ( 'Project1'[ID] ) ),
        'Project1'[Date]
    )
RETURN
    IF ( 'Project1'[Date] = _maxdate, "Consider", "Dont consider" )

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.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @alevandenes ,

Step 1: Assuming your dataset is like below

Dax_Noob_0-1664524190645.png


Step 2: Create a calculated column

MaxDate = 
IF (
    CALCULATE ( MAX ( Sheet1[Date] ), ALLEXCEPT ( Sheet1, Sheet1[ID] ) ) = Sheet1[Date],
    "Consider",
    "Dont Consider"
)


Step 3: End

Dax_Noob_1-1664524237621.png


BR

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your table looks like, but could you please try the below calculated column formula?

 

Consider CC =
VAR _maxdate =
    MAXX (
        FILTER ( 'Project1', 'Project1'[ID] = EARLIER ( 'Project1'[ID] ) ),
        'Project1'[Date]
    )
RETURN
    IF ( 'Project1'[Date] = _maxdate, "Consider", "Dont consider" )

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.


Go to My LinkedIn Page


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.