Forum Discussion
DATEADD combined with filter function
- 8 years ago
Hi Anthony007,
Based on my test, you could refer to below steps:
1.Create a calender table and create relationship with your row table:
2.Create two measures:
CountDay2 = VALUE(DATEDIFF (MIN ('Table'[Date]), MAX ('Table'[Date]), DAY))Measure = CALCULATE(COUNT(Sheet1[id]),DATEADD('Table'[Date],[CountDay2],DAY))3.Use the calender data column as the slicer,
Result:
You could also download the pbix file to have a view:
https://www.dropbox.com/s/3lkmj2bqmt8psle/DATEADD%20combined%20with%20filter%20function.pbix?dl=0
Regards,
Daniel He
Hi Anthony007,
Based on my test, you could refer to below steps:
1.Create a calender table and create relationship with your row table:
2.Create two measures:
CountDay2 = VALUE(DATEDIFF (MIN ('Table'[Date]), MAX ('Table'[Date]), DAY))Measure = CALCULATE(COUNT(Sheet1[id]),DATEADD('Table'[Date],[CountDay2],DAY))3.Use the calender data column as the slicer,
Result:
You could also download the pbix file to have a view:
https://www.dropbox.com/s/3lkmj2bqmt8psle/DATEADD%20combined%20with%20filter%20function.pbix?dl=0
Regards,
Daniel He
Many thanks for the response and help.
Creating a calendar table and relationships really helps in counting the number of days in a period. But at the same time, the date hierarchy is lost and the graph displays information in the wrong way:
And the result is the following:As if to compare this period with a similar one.
Perhaps there is another way to count the number of days in a period without creating a date table? Or try creating a date hierarchy manually?
I'm now trying to write a formula that simply considers the number of unique values in the date column using DISTINCTCOUNT