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
Anonymous
Not applicable

DAX code for sum of value from a specifi date

Hi all 🙂 

 

I am trying to calculate the number of vacation dates my employees have. my problem is, that I need to only see the vacation they have planned from 1st of september 2020. I would like to create a ned coloumn in a table, where I currently have three columns: The name of the employee, their initials, and how many vacation days he/she has earned from September.

 

The next coloum should the be the sum of vacation which the employee have planned, or already been on (from septermer 1st 2020).  I can't figure out how to create a DAX code, which allows me to sum the vacation days for the employees with the date filter. 

 

I hope you lovely people can help me with this! 🙂 Thank you so much in advance 

1 ACCEPTED SOLUTION

Hi, @Anonymous 

You can try to create a calculated column as follows to filter your vacation

Column = 
SUMX (
    FILTER (
        Vacation,
        'Vacation'[Employee] = 'Table'[Employee]
            && Vacation[Date_Month] >= DATE ( 2020, 09, 01 )
    ),
    Vacation[Vacation hour]
)


I am not clear about the structure of your timetable, so I made a simple example, hope it will work for you.

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

As sep last month you can use time intelligence and date table like given in the example

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))

 

Please provide your feedback comments and advice for new videos
Tutorial Series Dax Vs SQL Direct Query PBI Tips
Appreciate your Kudos.

Anonymous
Not applicable

Hi @amitchandak 🙂

 

I am not interesten in the last mtd, but from 1st of september 2020 to (forever). 

I have my time registration in one table and my calculations in another (see below).

 

ams_0-1603447345974.png

 

I would like the coloum Afholdt ferie (means Vacation which have already been held), to only show me the registred vacation from september and onwards. The table Ferie[Ferietimer] shows all the vacation from may 2019. 

My end goal is to somwhow create a DAX code, where it only takes the vacation posted after the 1st of september 2020, and sum it in the table. 

 

Hi, @Anonymous 

You can try to create a calculated column as follows to filter your vacation

Column = 
SUMX (
    FILTER (
        Vacation,
        'Vacation'[Employee] = 'Table'[Employee]
            && Vacation[Date_Month] >= DATE ( 2020, 09, 01 )
    ),
    Vacation[Vacation hour]
)


I am not clear about the structure of your timetable, so I made a simple example, hope it will work for you.

 

Best Regards,
Community Support Team _ Eason

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.