Support Formation DAX
Sans relation dans le modèle

icon picker
TREATAS


TREATAS (pas de relation)

[Filtered Measure] :=
CALCULATE (
<target_measure>,
TREATAS (
VALUES ( <lookup_granularity_column> ).
<target_granularity_column>
)
)
Retourne une table filtrée sur les <target_granularity_column> contenant les <lookup_granularity_column>.

TREATAS({"Red", "Green", "Yellow"}, DimProduct[Color])
Filtre la colonne Color sur ces 3 couleurs (même si l’une n’existe pas).

CALCULATE (
[Sales Amount],
TREATAS (
{ ( 2019, 12) , (2020, 1) },
‘Date’[Year Number],
‘Date’[Month Number]
)
)
Calcule l’expression Sales Amount, en filtrant l’année & le mois sur 2019 & 12 ou sur 2020 & 1.
Exemple “Promotion” :
CALCULATE (
[Sales Amount],
TREATAS (
SUMMARIZE (
Promotion,
Promotion [Promotion Category],
Promotion [Year] )
'Product'[Category],
'Date'[Calendar Year Number]
)
)
Autre exemple (”data lineage”)
EVALUATE
VAR Categories =
DATATABLE (
"Category", STRING,
{
{ "Category" },
{ "Audio" },
{ "TV and Video" },
{ "Computers and geeky stuff" },
{ "Cameras and camcorders" },
{ "Cell phones" },
{ "Music, Movies and Audio Books" },
{ "Games and Toys" },
{ "Home Appliances" }
}
)
RETURN
ADDCOLUMNS (
TREATAS (
Categories,
'Product'[Category]
),
"Amt", [Sales Amount]
)
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.