DAX intermediar în Power BI
Maarten Van den Broeck
Content Developer at DataCamp
DISTINCT(<table> | <table>)
Elimină rândurile duplicate dintr-un tabel sau valorile duplicate dintr-o coloană
SELECTCOLUMNS(<table>, <name>, <expression>)
Returnează coloanele selectate dintr-un alt tabel ca tabel nou
ADDCOLUMNS(<table>, <name>, <expression>)
Returnează tabelul de intrare cu coloanele selectate adăugate
SUMMARIZE(<table>,
<groupBy_columnName>,
<name>,
<expression>)
Returnează un tabel sumar pentru totalurile solicitate pe grupuri
ADDCOLUMNS(<table>, <name>, <expression>)
Returnează tabelul de intrare cu coloanele selectate adăugate
ADDCOLUMNS(Fact_table,
"Profit",
Revenue - Costs)
ADDCOLUMNS(<table>, <name>, <expression>)
Returnează tabelul de intrare cu coloanele selectate adăugate
ADDCOLUMNS(Fact_table,
"Profit",
Revenue - Costs)
| Revenue | Costs | Profit |
|---|---|---|
| 100 | 25 | 75 |
| 150 | 25 | 125 |
ADDCOLUMNS(<table>, <name>, <expression>)
Returnează tabelul de intrare cu coloanele selectate adăugate
ADDCOLUMNS(Fact_table,
"Profit",
Revenue - Costs)
| Revenue | Costs | Profit |
|---|---|---|
| 100 | 25 | 75 |
| 150 | 25 | 125 |
SELECTCOLUMNS(<table>, <name>, <expression>)
Returnează coloanele selectate dintr-un alt tabel ca tabel nou
SELECTCOLUMNS(Fact_table,
"Profit",
Revenue - Costs)
| Profit |
|---|
| 75 |
| 125 |
SUMMARIZE(<table>,
<groupBy_columnName>,
<name>,
<expression>)
Returnează un tabel sumar pentru totalurile solicitate pe grupuri
SUMMARIZE(<table>,
<groupBy_columnName>,
<name>,
<expression>)
Returnează un tabel sumar pentru totalurile solicitate pe grupuri
SUMMARIZE(Amounts,Amounts[Year], Amounts[Category],"Total Amount", SUM(Amounts[Amount]))
| Year | Category | Amount |
|---|---|---|
| 2019 | Tickets | 50 |
| 2019 | Postcards | 500 |
| 2020 | Tickets | 200 |
| 2020 | Tickets | 400 |
SUMMARIZE(<table>,
<groupBy_columnName>,
<name>,
<expression>)
Returnează un tabel sumar pentru totalurile solicitate pe grupuri
SUMMARIZE(Amounts,Amounts[Year], Amounts[Category],"Total Amount", SUM(Amounts[Amount]))
| Year | Category | Amount |
|---|---|---|
| 2019 | Tickets | 50 |
| 2019 | Postcards | 500 |
| 2020 | Tickets | 200 |
| 2020 | Tickets | 400 |
$$
| Year | Category | Total Amount |
|---|---|---|
| 2019 | Tickets | 50 |
| 2019 | Postcards | 500 |
| 2020 | Tickets | 600 |
SUMMARIZE() pot produce rezultate neașteptate în funcție de context$$
SUMMARIZE(Amounts,
Amounts[Year],
Amounts[Category]),
"Total Amount",
SUM(Amounts[Amount])
ADDCOLUMNS() în jurul lui SUMMARIZE() pentru coloane noiADDCOLUMNS(
SUMMARIZE(Amounts,
Amounts[Year],
Amounts[Category]),
"Total Amount",
SUM(Amounts[Amount])
)
DAX intermediar în Power BI