Forum Discussion

Enan's avatar
Enan
Helper I
3 years ago
Solved

Count for current month

Hi,

i want to make a measure to count below dates from dim table:

1. Today's date count

2. Current month date count

basically counting dates from my fact table gives me number of my staff not available for work.

 

i have seperate table for calandar as well which is linked to fact table.

 

i have tried to create below measure but it does not give correct value.

 

Today_Count= Calculate(Distinctcount(Fact_NOAV_data[Date]), Fact_NOAV_data=Today())

 

Current Month Count = Calculate(Count(Fact_NOAV_data[Date]),Month(Fact_NOAV_data[Date]=Month(Today()))

 

thank your help.

6 Replies

  • hi Enan 

    try like:

    Today_Count= Calculate(COUNTROWS(Fact_NOAV_data), Fact_NOAV_data[Date]=Today())
     
    Current Month Count = Calculate(COUNTROWS(Fact_NOAV_data),Month(Fact_NOAV_data[Date]=Month(Today()))
    • FreemanZ's avatar
      FreemanZ
      Super User

      or 

      Today_Count= Calculate(COUNTROWS(Fact_NOAV_data), 'Calendar'[Date]=Today())
       
      Current Month Count = Calculate(COUNTROWS(Fact_NOAV_data),Month('Calendar'[Date]=Month(Today()))
      if you plot with the Date column from the Calendar Table.
    • Enan's avatar
      Enan
      Helper I

      Thanks bro for helping.

      todays_count is working fine with countrows.

      but current month count with countrows is not working its gives total number of records in the table. I tried with calendar table as well but same answer. How to resolve this plz?

  • Thanks bro for helping.

    todays_count is working fine with countrows.

    but current month count with countrows is not working its gives total number of records in the table. I tried with calendar table as well but same answer. How to resolve this plz?