Forum Discussion

PKPK90's avatar
PKPK90
Icon for Helper I rankHelper I
3 years ago

Count of Weeks based on Date filter

Hi, I am trying to create a measure to show number of Weeks from Calendar table based on slicer date filter.
This is what I have done so far

CountWeeks = CALCULATE( DISTINCTCOUNT('Calendar'[YearWeek]), FILTER(VALUES('Calendar'), 'Calendar'[Date]>=[Minimum date] && 'Calendar'[Date]<=[Maximum date]))
 
it is working fine in visuals like card or as a single value, but when I am using it in table with columns it is always showing 1, so it is counting per column row, I would like to get the same value(91) regardless of additional variables.
Slicer for 'Calendar'[Date]:

 

Card visual: 

 

Connection:
MaterialTransactions is my table with all data needed
Calendar is my calendar table, also connected with different tables.

 

Expected result:

 

 

 

2 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Icon for Community Champion rankCommunity Champion

    CountWeeks = CALCULATE( DISTINCTCOUNT('Calendar'[YearWeek]), FILTER(ALLSELECTED('Calendar'), 'Calendar'[Date]>=[Minimum date] && 'Calendar'[Date]<=[Maximum date]))

  • Thank you for your input, but still I am receiving "1" per row.