Forum Discussion
DAX DEFINE COLUMN
- 1 year ago
Hi DoctorYSG
DEFINE COLUMN in DAX query view appears to work for me, but there an issue with Intellisense.
For example, this test query worked as expected for me:
DEFINE TABLE MyTable = {1,2,3} COLUMN MyTable[Value Squared] = MyTable[Value]^2 EVALUATE MyTableIf you run Performance analyzer on a visual containing a visual calculation then select Run in DAX query view, the query should also contain DEFINE COLUMN.
Hi DoctorYSG
DEFINE COLUMN in DAX query view appears to work for me, but there an issue with Intellisense.
For example, this test query worked as expected for me:
DEFINE
TABLE MyTable = {1,2,3}
COLUMN MyTable[Value Squared] = MyTable[Value]^2
EVALUATE
MyTable
If you run Performance analyzer on a visual containing a visual calculation then select Run in DAX query view, the query should also contain DEFINE COLUMN.
OwenAuger
I am tryhing to use the DAX query view to Run a query that Defines a COLUMN (and I would like to do that for TABLE as well). I understand that I will get intellisence sytnax flagging, but this one is giving errors about end of input. Any ideas if this is possible?
( I really need the VAR for clarity).
DEFINE
COLUMN
'Traces'[zResponseTime] =
VAR CurrentApp = 'Traces'[AppName]
VAR CurrentVersion = 'Traces'[AppVersion]
VAR CurrentBase = 'Traces'[BaseCode]
VAR CurrentDevice = 'Traces'[DeviceName]
VAR CurrentUser = 'Traces'[UserName]
VAR CurrentResponseTime = 'Traces'[ResponseTime]
VAR CurrentActivity = 'Traces'[ActivityName]
VAR mean =
CALCULATE(
AVERAGE('Traces'[ResponseTime]),
FILTER(
'Traces',
'Traces'[AppName] = CurrentApp &&
'Traces'[AppVersion] = CurrentVersion &&
'Traces'[BaseCode] = CurrentBase &&
'Traces'[DeviceName] = CurrentDevice &&
'Traces'[UserName] = CurrentUser &&
'Traces'[ActivityName] = CurrentActivity
)
)
VAR std =
CALCULATE(
STDEV.P('Traces'[ResponseTime]),
FILTER(
'Traces',
'Traces'[AppName] = CurrentApp &&
'Traces'[AppVersion] = CurrentVersion &&
'Traces'[BaseCode] = CurrentBase &&
'Traces'[DeviceName] = CurrentDevice &&
'Traces'[UserName] = CurrentUser &&
'Traces'[ActivityName] = CurrentActivity
)
)
RETURN
DIVIDE(
CurrentResponseTime - mean,
std,
0
)
It would be really nice to be able to testing things out in query view, and get TABLEs and COLUMNS added to the model. (as one can do with measures). I have DAX studio, but I suspect is it read one to the SSAS.