Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to create a measure using date column without aggregation?

I have 2 date columns that need to be compared to each other to see which date is greater than the other. If date1 > date2 then 0. If date1 < date2 then 1. From there I need to calculate the average between those 0-1 values. When performing DAX 

 

 

  • Hi, Anonymous ;

    You could create a measure as follow:

    flag2 = 
    AVERAGEX(SUMMARIZE('Table',[Date1],[date2],
    "1",IF(MAX('Table'[Date1])>MAX('Table'[date2]),0,1)),[1])

    The final show:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, Anonymous ;

    You could create a measure as follow:

    flag2 = 
    AVERAGEX(SUMMARIZE('Table',[Date1],[date2],
    "1",IF(MAX('Table'[Date1])>MAX('Table'[date2]),0,1)),[1])

    The final show:


    Best Regards,
    Community Support Team _ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.