Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Convert measure (dax) to column?

Hi, I am currently trying to create a column with an IF statement that returns back a 1 if true or 0 if false. The table shows every time a user has taken a sick day in their period of working and e...
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    [Absence Date] column is not inclued in your data sample.

    And how about the "in 4 months" ? If it always based on the [Work End Date]- 4 months ?

     

    I have tried the following formula

    Column = 
    var _minDate=DATEADD('Table (2)'[Work End Date].[Date],-4,MONTH)
    return  CALCULATE(SUM('Table (2)'[Amount(Days)]), FILTER('Table (2)',[User ID]=EARLIER('Table (2)'[User ID]) && [Sickness Date]>=_minDate && [Sickness Date]<=[Work End Date]))

    It will calculate the sum of Amount between:

      Date between  
    122 2016-6-5 2016-10-5
    214 2018-2-4 2018-6-4
    189 2021-8-14 2021-12-14



     

    Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.