Forum Discussion

SzymonKl's avatar
SzymonKl
Helper I
3 years ago
Solved

Day Name in DirectQuery

Could you kindly assist me in creating a measure to display the day name based on the 'ORDERS' table and the [ORDER_DATE] column? It's important to consider that we are working with DirectQuery, and thus, the FORMAT function cannot be used.

My approach not working : Day Name = FORMAT('ORDERS'[ORDER_DATE], "dddd") 

 

Thanks

 

 

  • Hi Thanks for your support today 🙂 

    I was able to find the right solution, instead measure I create a new column : 

    Day Name = SWITCH(WEEKDAY('ORDERS'[ORDER_DATE]),
                    1, "Sunday",
                    2, "Monday",
                    3, "Tuesday",
                    4, "Wednesday",
                    5, "Thursday",
                    6, "Friday",
                    7, "Saturday",
                    BLANK())

9 Replies

  • johnyip's avatar
    johnyip
    Solution Sage

    SzymonKl Not sure about this, but does the following work?

     

    Day Name(MEASURE) = FORMAT(MAX('ORDERS'[ORDER_DATE]), "dddd") 

     

     

    Or it is not working anyway because of DirectQuery?

     

    • SzymonKl's avatar
      SzymonKl
      Helper I

      Thanks for solution unfortunetlly i getting the error :

       

      • johnyip's avatar
        johnyip
        Solution Sage

        Sorry for the typo: it is MAX(

        Day Name(MEASURE) = FORMAT(MAX('ORDERS'[ORDER_DATE]), "dddd") 

         

  • mlsx4's avatar
    mlsx4
    Memorable Member

    Hi SzymonKl 

     

    Are you using a calendar table? Maybe you can compute the day name there and get it by using the relation?

    • SzymonKl's avatar
      SzymonKl
      Helper I

      No , the [ORDER_DATE] column is in 'ORDERS' table and is a Date/Time format.