Forum Discussion
Anonymous
3 years agoNot applicable
DAX - Count Days Between two date fields on a Date Axis
Hello, I'm trying to use DAX to count every day between two date fields for a large dataset and create a stacked column chart broken out by Program. You can do this in excel by means of the COUN...
- 3 years ago
Hi,
hope this will help you. Dynamic measure based on your calendar.
Count Correct Rows =var date_ref = SELECTEDVALUE(dim_calendar[Date])returnCOUNTX(FILTER('Sample';AND('Sample'[Status Start Date] <= date_ref;'Sample'[Status End Date]>=date_ref));COUNTROWS('Sample'))You can use Program column as you want. No relationship needed.
Bifinity_75
3 years agoSolution Sage
Hi Anonymous , try this calculate column:
COUNTIFS = CALCULATE(COUNTROWS('Program Status Table'),
FILTER(ALL('Program Status Table'),'Program Status Table'[Status Start Date] <='Date Table'[Date] && 'Program Status Table'[Status End Date]>='Date Table'[Date]))
The result:
Best Regards
Anonymous
3 years agoNot applicable
Hi Bifinity_75 ,
Using the calculated column worked, but it I am not able to add Program to the legend. How can I modify the formula to accept the row context for Program?