m-kovalsky / Fabric

Useful code for fabric notebooks
MIT License
129 stars 23 forks source link

%%DAX magic commands do not work #4

Closed MikeCarlo closed 3 months ago

MikeCarlo commented 4 months ago

When trying to use the DAX magic commands the notebooks results in failures.

image

However, when using evaluate_dax method from sempy I am able to return a table

image

m-kovalsky commented 4 months ago

I just ran the same type of code and it worked just fine. Is this semantic model in the same workspace as the notebook?

image
MikeCarlo commented 3 months ago

I must be doing something wrong,

These commands work image

However when I run %%dax I get the failure image

Also to confirm the Lakehouse is inside the same workspace Demo - Learn Fabric - 02 image

Is there a certain version I should be on within spark to use this?

MikeCarlo commented 3 months ago

This is my spark session

{
  "timestamp": "2024-07-09T19:54:51.236Z",
  "transientCorrelation": "93c128e0-dee1-441f-b542-04dbc99743d0",
  "aznb": {
    "version": "1.6.71"
  },
  "notebook": {
    "notebookName": "Sempy Work",
    "instanceId": "05bb7be5-94e6-4f80-8ad7-feb58b98dbad",
    "documentId": "trident-w-7954c90e-6e8e-4f3a-a34a-994b9d1c66c8-a-d386dd22-53a4-4ff2-ab8d-3a6843e172f1",
    "workspaceId": "7954c90e-6e8e-4f3a-a34a-994b9d1c66c8",
    "kernelId": "5d422c5a-3999-4046-8de8-5004956d2f8d",
    "clientSessionId": "d9ce6549-c388-4735-a7bf-0b0f1b2efb95",
    "kernelState": "idle",
    "computeUrl": "https://pbipncus13-northcentralus.pbidedicated.windows.net/webapi/capacities/6448F64C-8EC8-4008-90CF-EDD1E9811B6C/workloads/Notebook/Data/Direct/api/workspaces/7954c90e-6e8e-4f3a-a34a-994b9d1c66c8/artifacts/d386dd22-53a4-4ff2-ab8d-3a6843e172f1/jupyterApi/versions/1",
    "computeState": "connected",
    "collaborationStatus": "offline / joined",
    "isSaveLeader": true
  },
  "synapseController": {
    "id": "05bb7be5-94e6-4f80-8ad7-feb58b98dbad:snc2",
    "enabled": true,
    "activeKernelHandler": "sparkLivy",
    "language": "python",
    "state": "idle",
    "sessionId": "470126eb-54b4-4001-bd56-12e59b136ebd",
    "applicationId": "application_1720554140124_0001",
    "applicationName": "Sempy Work_470126eb-54b4-4001-bd56-12e59b136ebd",
    "runtimeVersion": "1.2",
    "sessionErrors": []
  }
}
MikeCarlo commented 3 months ago

Also trying a bump in the Fabric Runtime to be 1.3 (Spark 3.5 and Delta 3.1) still not working.

Does this not work for a Default dataset in directlake mode?

image

eisber commented 3 months ago

you need to use DAX style comments (e.g. //) not python style (e.g. #).

the syntax highlighting not supporting DAX is a known issue.

MikeCarlo commented 3 months ago

Oh my WORD, that fixed it!!!

This looks so wrong since it cause the red lines to apply under my syntax.

image

This is highly confusing!