Group by in DAX like in SQL
-
25-02-2021 - |
Lösung
SUMMARIZECOLUMNS is the main function to use here.
So this:
select SUM(Kiekis )
from Info
left outer join Prekes on Info.PrekeID = Prekes.PrekeID
left outer join PrekiuGrupes on Prekes.PrekiuGrupeID = PrekiuGrupes.PrekiuGrupeID
group by PrekiuGrupesID
would be simply
EVALUATE (
SUMMARIZECOLUMNS(PrekiuGrupes[PrekiuGrupesID], "TotalKiekis", Sum(Info[Kiekis]) )
)
DAX traverses the active relationships in the model, so there's no need to use explicit JOINs. And instead of having a structured query language DAX uses function argument types to detect the different "clauses". The first string argument to SUMMARIZECOLUMNS
indicates the transition from "group by" columns, to pairs of (String,Expression) to specify the result columns.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit dba.stackexchange