Forum Discussion
DATESBETWEEN with two tables
- 6 years ago
VasTg wrote:How is the relationship between the fact and date is defined?
It is a one-to-many relationship between the date from the date table to the start date in the fact table.
VasTg wrote:Here is the sample DAX that works for me.
Column = CALCULATE(SUM('Table 2'[Holiday]),FILTER(ALL('Table 2'),'Table 2'[Date]>='Fact'[Start] &&'Table 2'[Date]<='Fact'[End]))This did not work for me either as DAX is not allowing my to compare the dates from the Fact table to the Date table, I suspect for the same reason as I'm not able to use the functions I intended to.
How is the relationship between the fact and date is defined?
Here is the sample DAX that works for me.
Column = CALCULATE(SUM('Table 2'[Holiday]),FILTER(ALL('Table 2'),'Table 2'[Date]>='Fact'[Start] &&'Table 2'[Date]<='Fact'[End]))
Table 2 is date(Holiday is a column with value 1 as holiday and 0 is a non holiday)
Fact is your fact.
If this helps, mark it as a solution
Kudos are nice too
- JonV6 years ago
Helper II
VasTg wrote:How is the relationship between the fact and date is defined?
It is a one-to-many relationship between the date from the date table to the start date in the fact table.
VasTg wrote:Here is the sample DAX that works for me.
Column = CALCULATE(SUM('Table 2'[Holiday]),FILTER(ALL('Table 2'),'Table 2'[Date]>='Fact'[Start] &&'Table 2'[Date]<='Fact'[End]))This did not work for me either as DAX is not allowing my to compare the dates from the Fact table to the Date table, I suspect for the same reason as I'm not able to use the functions I intended to.
- VasTg6 years ago
Memorable Member
Try variables to get the start and end date from fact.
Attach your mockup pbix to troubleshoot.
If this helps, mark it as a solution
Kudos are nice too
- JonV6 years ago
Helper II
Here is a link to a sample pbix. Please let me know if that works.