Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I am new to DAX and hope you can help me with the syntax below. Look at SQL command, I need to mimic the query in DAX but keept getting error. Thanks
SQL command
select order, line, max(cot) cot
from my table
group by order, line
DAX query
EVALUATE
SUMMARIZECOLUMNS (
'tbl Order'[Order],
'tbl Order'[line],
MAX('tbl Order'[cot])
)
group by
'tbl Order'[Order],
'tbl Order'[line]
Hi @hongho2
please try
EVALUATE
SUMMARIZECOLUMNS (
'tbl Order'[Order],
'tbl Order'[line],
"Cot", CALCULATE ( MAX ( 'tbl Order'[cot] ) )
)
Thanks for your response. I got error below.
Query (9, 5) Function SUMMARIZECOLUMNS expects a column name as argument number 6.
Can I have "cot", CALCULATE ( MAX ('tbl Order'[cot] ) ) as the filter, can you show me how?
error:
Query (14, 3) Function SUMMARIZECOLUMNS expects a column name as argument number 9.
EVALUATE
SUMMARIZECOLUMNS (
'tbl Order'[ID],
'tbl Order'[Order],
'tbl Order'[line],
"cot", CALCULATE ( MAX ('tbl Order'[cot] ) ),
FILTER ('tbl ID',[ ID] =250 )
Please try
EVALUATE
FILTER (
SUMMARIZECOLUMNS (
'tbl Order'[ID],
'tbl Order'[Order],
'tbl Order'[line],
"cot", CALCULATE ( MAX ( 'tbl Order'[cot] ) )
),
[ ID] = 250
)
Thank you very much for your promt reponse. I need to have more filters from the other tables and display amount, but keep getting errors.
@hongho2
No information about your data model so I'm trying to guess
EVALUATE
SUMMARIZE (
FILTER (
'tbl Order',
'tbl Order'[ID] = 250
&& 'tbl order'[city] = BLANK ()
&& 'tbl order'[dirt] = "No"
&& RELATED ( 'tbl type'[Type] ) <> "air"
&& RELATED ( 'tbl item'[email] ) = "No"
),
'tbl Order'[ID],
'tbl Order'[Order],
'tbl Order'[line],
"cot", MAX ( 'tbl Order'[cot] ),
"Order Amount", [Order Amount]
)
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
37 | |
25 | |
19 | |
14 | |
8 |
User | Count |
---|---|
68 | |
48 | |
45 | |
18 | |
15 |