0

I'm trying to create a measure that counts the number of Mondays and will update based on the date range slicer I have created. For example, if I select all of March with my date slicer, the measure will be 5. If I select all of March and back to February 20, it would show 6. I tried the below code and it just calculates the total number of Mondays in the entire dataset and doesn't change when I adjust the date range slicer.

CALCULATE(DISTINCTCOUNT('Table'[DATE]),WEEKDAY('Table'[DATE]) = 2),0)

Any thoughts are appreciated.

kedar sedai
  • 1,687
  • 3
  • 16
  • 25
David
  • 7
  • 4

1 Answers1

0

Add a new DAX column

Weekday = WEEKDAY('Table'[Date])

and the following measure:

Measure = CALCULATE(COUNT('Table'[Column1]); 'Table'[Weekday] = 2)

this way it works. But I am wondering this one doesnt work (similar to your ones because your expression should have worked also)

Measure = CALCULATE(COUNT('Table'[Column1]); WEEKDAY([Column1]) = 2)

when it should also work ?!?!

Strawberryshrub
  • 3,301
  • 2
  • 11
  • 20
  • Thanks for the help. However, this method still is not updating when I change the date range slicer. If I expand to show the whole range of dates, it shows 2098 (all the rows in my dataset), but if cut it down to just a week or two, it still shows 2098. If I filter down to just Monday in my measure, it shows 426, but again, doesn't update if I change the date range. – David Apr 01 '20 at 17:28
  • Never mind. I think I've got it now. Thank you for your help! – David Apr 01 '20 at 17:40