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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

Dax Formula

Hi all, 

 

 I have a data table like below.  The data table represent an temp worker with the start date and end date. I would like to get a count a daily count of temp worker starting- daily sum of temp worker ending there work. I am trying to get a net value per day. How would I be able to achieve this?

 

2111233.PNG

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, 

According to your description, I can roughly understand your requirement, I think you can try to use this method to achieve your requirement:

This is the test data I created based on your description:

vrobertqmsft_0-1641537113248.png

 

First you can create a calendar table to place into the date slicer as the selected date, you can change the date range based on your dataset:

Calendar = CALENDAR(DATE(2021,1,1),DATE(2021,1,5))

 

Then you can create a measure like this:

Count of diff =

var _selecteddate=SELECTEDVALUE('Calendar'[Date])

var _CountofStart=COUNTX(FILTER(ALL('Table'),[StartDate]=_selecteddate),'Table'[StaffNameStringId])

var _CountofEnd=COUNTX(FILTER(ALL('Table'),[EndDate]=_selecteddate),'Table'[StaffNameStringId])

return

_CountofStart-_CountofEnd

 

And you can create a date slicer and a card chart to get what you want, like this:

vrobertqmsft_1-1641537113253.png

 

You can download my test pbix file below

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

View solution in original post

3 REPLIES 3
v-robertq-msft
Community Support
Community Support

Hi, 

According to your description, I can roughly understand your requirement, I think you can try to use this method to achieve your requirement:

This is the test data I created based on your description:

vrobertqmsft_0-1641537113248.png

 

First you can create a calendar table to place into the date slicer as the selected date, you can change the date range based on your dataset:

Calendar = CALENDAR(DATE(2021,1,1),DATE(2021,1,5))

 

Then you can create a measure like this:

Count of diff =

var _selecteddate=SELECTEDVALUE('Calendar'[Date])

var _CountofStart=COUNTX(FILTER(ALL('Table'),[StartDate]=_selecteddate),'Table'[StaffNameStringId])

var _CountofEnd=COUNTX(FILTER(ALL('Table'),[EndDate]=_selecteddate),'Table'[StaffNameStringId])

return

_CountofStart-_CountofEnd

 

And you can create a date slicer and a card chart to get what you want, like this:

vrobertqmsft_1-1641537113253.png

 

You can download my test pbix file below

 

If this result is not what you want, you can post some sample data(without sensitive data) and your expected result.

How to Get Your Question Answered Quickly 

Thank you very much!

 

Best Regards,

Community Support Team _Robert Qin

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

VahidDM
Super User
Super User

This link is helpful as well:

https://www.vahiddm.com/post/calculating-business-hours-in-power-bi-using-dax

 


Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

VahidDM
Super User
Super User

Hi @Anonymous 

 

You can use DATEDIFF to find the days between Start and End dates.

 

something like this:

DATEDIFF(table[StartDate], table[EndDate], Day)

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

New Year Power BI eCard:

 

https://community.powerbi.com/t5/Data-Stories-Gallery/Happy-New-Year/td-p/2266398

 

 

 

eb50dd_d85fbe053af7491e915ca41732d978a7~mv2

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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