Forum Discussion

joshua1990's avatar
joshua1990
Post Prodigy
6 years ago
Solved

Filter just for completed months

Hello everybody!

I need to add a column to my calendar to filter in my views just for completed months.

The calendar I am using is a fiscal calendar like

Date - Fiscal Month

 

Does someone know any dax function to get a False/ True, of the date is within a completed fiscal month?

  • Anonymous's avatar
    Anonymous
    6 years ago
    // Let's say that FiscalMonthID is
    // a unique identifier of a fiscal
    // month in Calendar.
    
    [Full Fiscal Month] = // calculated column
    var __today = TODAY()
    var __currentFiscalMonth = Calendar[FiscalMonthID]
    var __allFiscalMonthDatesAreOK =
    	ISEMPTY(
    		FILTER(
    			'Calendar',
    			Calendar[FiscalMonthID] = __currentFiscalMonth
    			&&
    			Calendar[Date] > __today
    		)
    	)
    RETURN
    	__allFiscalMonthDatesAreOK

     

    Best
    D

10 Replies

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    This should get your desired result in a calculated column (this example is on the Date table).

     

    Month Complete = IF(EOMONTH('Date'[Date],0)<=TODAY(), "Yes", "No")
     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

    • joshua1990's avatar
      joshua1990
      Post Prodigy

      mahoneypat Thanks a lot! Are you sure this works with a fiscal month with individual end dates for each month (mentioned in starting post)?

      • mahoneypat's avatar
        mahoneypat
        Microsoft Employee

        It won't work for fiscal months. I forgot about that part.  What is your logic to determine the fiscal month.  If you share it, I will try an alternate expression.

        Regards,

        Pat

         

    • SPillai's avatar
      SPillai
      New Member

      That's really clever  👍   Just one line to cater for end of month check, amazing!

    • joshua1990's avatar
      joshua1990
      Post Prodigy

      Thanks for the reply!

      A month is completed when every day is in the past