Forum Discussion
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?
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:
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-_CountofEndAnd you can create a date slicer and a card chart to get what you want, like this:
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.
3 Replies
- VahidDMSuper 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
- VahidDMSuper 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/ - v-robertq-msftCommunity 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:
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-_CountofEndAnd you can create a date slicer and a card chart to get what you want, like this:
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.