Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I have a dataset with three columns: department, date (with the latest filter applied), and work order number. For each department, I am trying to calculate the number of work orders that have the date listed in the table.
I applied a department filter here for simplicity. An example of an expected result would be for the date of Monday, December 20, the measure or column would show a value of 2 since there are two work orders listed on that date. I would like the number of occurrences for each latest date for each department.
Any help here would be appreciated.
Solved! Go to Solution.
@Anonymous , Try a measure like
Measure =
VAR __id = MAX ('Table'[department] )
VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[department] = __id )
CALCULATE ( distinctcount ('Table'[WorkOrd] ), VALUES ('Table'[department] ),'Table'[department] = __id,'Table'[Date] = __date )
Hi, @Anonymous
Could you please tell me whether your problem has been solved?
If yes, you could accept the helpful answer as solution. You could also share your own solution here.It will help other community members easily find the solution when they get the similar issue.
Best Regards,
Community Support Team _ Eason
You can use a measure like:
Your Measure =
CALCULATE(
COUNT( 'Table'[WorkOrd] ),
ALLSELECTED('Table'[WorkOrd])
)
@Anonymous , Try a measure like
Measure =
VAR __id = MAX ('Table'[department] )
VAR __date = CALCULATE ( MAX('Table'[Date] ), ALLSELECTED ('Table' ), 'Table'[department] = __id )
CALCULATE ( distinctcount ('Table'[WorkOrd] ), VALUES ('Table'[department] ),'Table'[department] = __id,'Table'[Date] = __date )
Hi,
Thank you for your prompt reply. I have tried inserting the measure based on your feedback above and it is throwing this error:
I am fairly new to DAX/measure syntax so any help is appreciated.
You'd need "RETURN" before calculate function!