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.
Tengo un montón de medida terrible y compleja de otros proyectos.
¿Hay alguna manera de simplificar y comprimir tales medidas como:
VAR valText1 = "Text1"
VAR valText12 = "Text2"
VAR subt =
CALCULATE (
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER (
'Table',
'Table'[Type1] IN { 0 }
&& NOT 'Table'[Type2] = 2
&& NOT 'Table'[Code] IN { valText1, valText12 }
)
),
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)
- CALCULATE (
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER (
'Table',
'Table'[Type1] IN { 0 }
&& 'Table'[Type2] = 2
&& NOT 'Table'[Code] IN { valText1, valText12 }
)
),
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)
- CALCULATE (
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER (
'Table',
'Table'[Type1] IN { 0 }
&& 'Table'[Code] IN { valText1, valText12 }
&& 'Table'[Sign] > 0
)
),
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)
- CALCULATE (
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER (
'Table',
'Table'[Type1] IN { 0 }
&& 'Table'[Code] IN { valText1, valText12 }
&& 'Table'[Sign] < 0
)
),
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)
+ - CALCULATE (
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER ( 'Table', 'Table'[Type1] IN { 2 } )
),
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
)
RETURN
SWITCH(TRUE(),
"505s" in distinct ( 'Table_2'[Column1] ) ,
- subt,
"948r" in distinct ( 'Table_2'[Column1] ),
subt
)
Prueba esto:
col =
VAR valText1 = "Text1"
VAR valText12 = "Text2"
VAR ListOfDate =
FILTER ( ALL ( 'Date'[Date] ), 'Date'[Date] <= MAX ( 'Date'[Date] ) )
VAR F =
FILTER (
'Table',
'Table'[Type1] IN { 0 }
&& NOT 'Table'[Code] IN { valText1, valText12 }
)
VAR subt1 =
CALCULATE (
SUM ( 'Table'[Sum] ),
F,
KEEPFILTERS ( 'Table'[Type2] <> 2 ),
ListOfDate
)
VAR Subt2 =
CALCULATE (
SUM ( 'Table'[Sum] ),
F,
KEEPFILTERS ( 'Table'[Type2] = 2 ),
ListOfDate
)
VAR Subt3 =
CALCULATE (
SUM ( 'Table'[Sum] ),
F,
KEEPFILTERS ( 'Table'[Sign] > 0 ),
ListOfDate
)
VAR Subt4 =
CALCULATE (
SUM ( 'Table'[Sum] ),
F,
KEEPFILTERS ( 'Table'[Sign] < 0 ),
ListOfDate
)
VAR Subt5 =
CALCULATE (
SUM ( 'Table'[Sum] ),
FILTER ( 'Table', 'Table'[Type1] IN { 2 } ),
ListOfDate
)
VAR Result = subt1 - Subt2 - Subt3 - Subt4 - Subt5
RETURN
SWITCH (
TRUE (),
"505s" IN DISTINCT ( 'Table_2'[Column1] ), - Result,
"948r" IN DISTINCT ( 'Table_2'[Column1] ), Result
)
@Analitika ,¿Puede compartir datos de ejemplo y salida de ejemplo en formato de tabla y lógica de fórmula.
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 |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |