Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now
Hi together,
currently Im exploring DAX Queries with SSAS conncetor.
However, it seems that I cant use "" to name columns.
This is very strange because apostroph is used in all youtube videos I saw about this topic.
DEFINE
MEASURE Table1[M1] = SUM ( Table1[Column1] )
EVALUATE
SUMMARIZECOLUMNS (
Table1[DateColumn].[Year],
"TestName", [M1] --> here is the error
)
error message: expected token ","
When I write TestName between the apostrophs, Power Query Intellisense is turning on.
So, it seems that PQ thinks that I want to write a formula here.
Note: Im in Germany , Model language is set to English (USA), DAX formatting is set to standard.
Thanks for any help.
Kind regards
Solved! Go to Solution.
Ah, Ok, Now I understand what you are trying to do. The quotes need escaping, by using two double quotes instead of one. See my examply below.
let
Source = AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/xxxxxxxxxxxxxxx", "yyyyyyyyyy", [Query="EVALUATE#(lf)SUMMARIZECOLUMNS(#(lf)'date'[nr year]#(lf),""# ap"", [# active policies]#(lf))", Culture="nl-NL"])
in
Source
Easiest is to use the dialog box when adding the source, or editing the source step.
Ah, Ok, Now I understand what you are trying to do. The quotes need escaping, by using two double quotes instead of one. See my examply below.
let
Source = AnalysisServices.Database("powerbi://api.powerbi.com/v1.0/myorg/xxxxxxxxxxxxxxx", "yyyyyyyyyy", [Query="EVALUATE#(lf)SUMMARIZECOLUMNS(#(lf)'date'[nr year]#(lf),""# ap"", [# active policies]#(lf))", Culture="nl-NL"])
in
Source
Thank you @sjoerdvn ,
this solved it! Just to understand it, can you explain why I need double quotes instead of one?
The dax query is part of the Power Query code and should start and end with a double quote; so when the dax query itself contains a double quote character, Power query thinks that is where the dax query ends. To be able to tell the difference between a double quote within the dax query, and a double quote ending the dax query, an "escape sequence" is used for double quotes within the dax query.
Escaping is a common thing in computer science.
Thank you!
Since you're mentioning "power query", in what context are you executing this? maybe send a screenshot?
Hi,
here the screeenshot from Power Query:
Hi,
this doesnt fix it as the comma is not the cause of the error.
The problem are the ""
It is that reference to an autodate column that is causing the issue here (Table1[DateColumn].[Year])
That will not work here, see the purple box in this article:
https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-auto-date-time
Hi,
the column isnt the problem.
I tried it with other columns and get the same error.
Check out the October 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
33 | |
16 | |
13 | |
10 | |
8 |
User | Count |
---|---|
59 | |
20 | |
12 | |
11 | |
10 |