Forum Discussion

ssvr's avatar
ssvr
Helper III
8 years ago
Solved

DAX

I want to create a measure;

Fetch the Month name from Date column

  • You can try this
    MonthName=
    VAR Date_= SELECTEDVALUE(Table[DateColumn])
    RETURN FORMAT(Date_, "mmmm")

    Note: this returns a value if there is only one date in the current filter context.

    If this isn't what your desired result, please provide a sample date and your expected result.

7 Replies

  • You can try this
    MonthName=
    VAR Date_= SELECTEDVALUE(Table[DateColumn])
    RETURN FORMAT(Date_, "mmmm")

    Note: this returns a value if there is only one date in the current filter context.

    If this isn't what your desired result, please provide a sample date and your expected result.
    • ssvr's avatar
      ssvr
      Helper III

      May be you are right. But my case is:

       

      I Connected the SAP-Cube to Power BI.

      In this senario New Column is Disabled and there is only (New Measure) i can created.

       

      So, In this senario Please suggest me the DAX for below requirements:

       

      - Get the Month Name from #Date column

      - Diffarence between two #Dates ( = ReleaseDt - OpenDt)

       

      Thanks.

    • ssvr's avatar
      ssvr
      Helper III

      I need to create only Measure not Column

       

       

      Agening between two dates = Closeddt - Releasedt

    • ssvr's avatar
      ssvr
      Helper III

      Hi danextian ,

       

      Can you help me out with this query

       

      One of my mate share dis DAX (Measure) for date diffarece. But i got some errors with query can you fix this

      [ClosedDt-CreatedDt]

       

      Daydiff = VAR Created = MAX('Dates'[CreatedDt])
      VAR Closed = MAX('Dates'[ClosedDt])
      VAR dd=-1
      IF (Closed>Created) {
      dd=DATEDIFF(Created;Closed;days)
      } else {
      dd= DATEDIFF(Closed;Created;days)
      }
      RETURN dd

  • Hi ssvr,

    you can try this function

    New column = SWITCH(Month(date column),1,"January",2,"February",...)
  • ssvr's avatar
    ssvr
    Helper III

    I Connected the SAP-Cube to Power BI.

    In this senario New Column is Disabled and there is only (New Measure) i can created.

     

    So, In this senario Please suggest me the DAX for below requirements:

     

    - Get the Month Name from #Date column

    - Diffarence between two #Dates ( = ReleaseDt - OpenDt)

     

    Thanks.