Forum Discussion

phuongui's avatar
phuongui
Frequent Visitor
9 years ago
Solved

Can not New Table or use DAX function in DirectQuery mode

Dear all,   I have a problem when use DirectQuery mode to get SQL Server Database. I turned on "Allow unrestricted measures in DirectQuery mode" but it can use another features such as, New Table o...
  • prateekraina's avatar
    9 years ago

    Hi phuongui,

    Creating a new table is not allowed in Direct Query even if you Allow Restricted stuff.

    I faced the same problem at my end but since i had to create a small table of 7 rows and 2 columns, i did the following:

    1. In Query Editor Section, right click on your any of the existing table and click on duplicate.
    2. Rename it, Now in PowerQuery section, remove the steps, if any, after Source.
    3. Edit source and wriite a custom SQL query to create your own table.

    Note: By creating table i mean, use SELECT and UNION ALL to create your table.
    Eg:

    SELECT 1 AS [StudentID]
    ,'Ryan' AS [StudentName]
    
    UNION ALL
    
    SELECT 2 AS [StudentID]
    ,'David' AS [StudentName]

    This approach can be useful if you have to create small table and when you can't afford to switch from DirectQuery mode to other.

    Thanks !!

  • prateekraina's avatar
    prateekraina
    9 years ago

    Hi phuongui,

    As far as i know, FORMAT is not allowed while creating a 'Column' in DAX. It can be used while creating a 'Measure'
    Nevertheless, if you just want to take month from Date colulm, use below DAX, it will work for sure:

    MonthColumn = MONTH([Date])

    Thanks !!