Forum Discussion

Bustardo's avatar
Bustardo
Helper I
9 years ago
Solved

Dax Question re: Datesbetween

I have a question as to why these measures are giving me different results  because it does not make sense to me.

 

I have a Table, we'll call products. There is a column called ActualDate. The Minimum Value I have in this field is 7/1/2016, The MAX value I have in the Actualdate field is 6/30/2017.  (currently just 1 year)

 

 

 

Product id count:=CALCULATE(COUNT(Product[ProductID] ))


ProductIDCount with date:=CALCULATE(COUNT(Product[Productid] ), DATESBETWEEN(DimDate[Date],[FYSTARTDATE],[FYENDDATE]))

FYSTARTDATE:=Min(ProgramYear[Start Date])


FYENDDATE:=Min(ProgramYear[End Date])

FYSTARTDATE = FYSTARTDATE: 7/1/2016

 

FYENDDATE = FYENDDATE: 6/30/2017

 

DimDate[Date] is a date table with a large range of Dates, that's all that exists on it and there is a relationship between ActualDate and the Date table.

 

 

So my question is what am I missing? I've looked and I have no values outside this date range. Why is the Datesbetween changing the outcome? I'd expect Identical numbers.

  • Hmm. I cannot seem to replicate this. That being said, the syntax seems weird to me. My suspician is that there is something wonky going on in your relationship between the tables. For example, I was able to replicate this when the things that I was counting did not have matching relationships in the dimDate table. So, I might have 8 items, but I only had 6 dates in my dimDate table. So, do all of your ActualDates match up with all of the dates in your dimDate table?

     

    Would be interested if you could post some sample data in a table that could be used to replicate this issue. 

8 Replies

    • Bustardo's avatar
      Bustardo
      Helper I
      From the first one, without dates, I'm getting about 300,000 results. When i use the datesbetween its going down to 34,000 which doesn't make sense to me because all rows are between those dates.
      • Greg_Deckler's avatar
        Greg_Deckler
        Community Champion

        Hmm. I cannot seem to replicate this. That being said, the syntax seems weird to me. My suspician is that there is something wonky going on in your relationship between the tables. For example, I was able to replicate this when the things that I was counting did not have matching relationships in the dimDate table. So, I might have 8 items, but I only had 6 dates in my dimDate table. So, do all of your ActualDates match up with all of the dates in your dimDate table?

         

        Would be interested if you could post some sample data in a table that could be used to replicate this issue.