Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hola guya,
Espero que todos estén a salvo,
Tengo un requisito donde necesito calcular la suma de la cantidad basada en cierto filtro y condición.
las condiciones son:
1. si El tipo es "inf", entonces sólo calcule la suma cuando con_type como %A% más suma (cantidad) del tipo.
2.sum( cantidad reservada) debe ser mayor que 0 cuando se exporten datos subyacentes
He probado una medida, pero que filtrar todo para con_type como %A% que está mal, sólo quiero "inf" para obtener filtro notth otra cosa, es decir.
Prueba de BQ ( BQ test)
VAR inf ?
CALCULAR (
SUM ( Reservas[CANTIDAD] ),
Bookings[Type] á "inf"
)
VAR qty ?
SI (
Inf
(
CALCULAR (
SUM ( Reservas[CANTIDAD] ),
FILTRO (
Reservas
Bookings[Con_type] á "A-N"
|| Bookings[Con_type] á "A"
)
)
),
CALCULATE ( SUM ( Reservas[QUANTITY] ) )
)
VAR qty2 ?
SI (
Inf
(
CALCULAR (
SUM ( Reservas[CANTIDAD] ),
FILTRO ( Reservas, Reservas[QUANTITY] > 0 ),
FILTRO (
Reservas
Bookings[Con_type] á "A-N"
|| Bookings[Con_type] á "A"
)
)
),
CALCULAR (
SUM ( Reservas[CANTIDAD] ),
FILTRO ( Reservas, Reservas[QUANTITY] > 0 )
)
)
devolución
IF ( qty > 0, qty, qty2 )
A continuación se muestra la tabla de los datos:
Tipo | Con_type | Cantidad |
Inf | Oth | 0 |
Lc | 'A'n' | 1 |
Lc | A. | 1 |
Inf | Oth | 2 |
Inf | 'A'n' | 0.4 |
Lc | 'A'n' | 0 |
Inf | 'A'n' | 0 |
Inf | Oth | 1 |
Lc | A. | 10 |
Aplicación | 'A'n' | -1 |
Inf | Oth | 2 |
Aplicación | Oth | 1 |
Inf | Oth | 2 |
Lc | Oth | 1 |
Inf | Oth | 2 |
Inf | Oth | 0 |
Lc | Oth | 0 |
Inf | Oth | 4 |
Inf | Ns | 3 |
Inf | Oth | 2 |
Inf | Oth | 2 |
Inf | Oth | 4 |
Inf | Oth | 0 |
Inf | Oth | 2 |
Inf | Oth | 3 |
Aplicación | A. | 0.5 |
Lc | Oth | 6 |
Inf | Oth | 4 |
Inf | Oth | 0 |
Inf | Oth | 2 |
Inf | Oth | 1 |
Inf | Oth | 0 |
Inf | Oth | 1 |
Inf | Oth | 1 |
Inf | Oth | 2 |
Inf | Ns | 0 |
Inf | Ns | 0 |
Lc | Oth | 0 |
Inf | Ns | 4 |
Aplicación | A. | 1 |
Lc | Ns | -6 |
Lc | Ns | 0 |
Aplicación | A. | 1 |
Inf | A. | 0 |
Inf | A. | 1 |
Aplicación | A. | 1 |
Inf | Oth | -0.5 |
por favor ayúdame con la corrección en medida.
Gracias
Solved! Go to Solution.
Puede agregarlo en Calculate()
SumIF inf %A% =
CALCULATE (
SUM ( 'Type'[QUANTITY] ),
'Type'[QUANTITY] > 0,
FILTER (
'Type',
OR (
'Type'[Type] <> "inf",
AND ( 'Type'[Type] = "inf", SEARCH ( "{A}", 'Type'[Con_type],, 0 ) > 0 )
)
)
)
Si esto funciona para usted, márquelo como la solución. Los elogios también son apreciados. Por favor, avísame si no.
saludos
palmadita
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
No estoy seguro de lo que significa su segunda condición, pero aquí hay una expresión que creo que #1 (si no también #2).
SumIF inf %A% =
CALCULATE (
SUM ( 'Type'[QUANTITY] ),
FILTER (
'Type',
OR (
'Type'[Type] <> "inf",
AND ( 'Type'[Type] = "inf", SEARCH ( "{A}", 'Type'[Con_type],, 0 ) > 0 )
)
)
)
Si esto funciona para usted, márquelo como la solución. Los elogios también son apreciados. Por favor, avísame si no.
saludos
palmadita
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Gracias por esto,
Funcionó para la 1a condición, pero no para la segunda.
Permítanme elaborar un poco,
si ve la tabla, tiene 0 y valores negativos en cantidad. Cuando un usuario exporta este conjunto de datos subyacente, ve 0 y valores negativos, que no quiero que muestren. Quiero que, si el usuario exporta sólo ven valores mayores que 0. El meausre que he subido me estaba dando ese resultado mientras ocultaba el campo original y les daba esta medida para exportar.
ver la imagen siguiente, quiero evitar esos valores ceros en profundizar y exportar, por lo tanto tomando la suma de la cantidad reservada mayor que cero.
Puede agregarlo en Calculate()
SumIF inf %A% =
CALCULATE (
SUM ( 'Type'[QUANTITY] ),
'Type'[QUANTITY] > 0,
FILTER (
'Type',
OR (
'Type'[Type] <> "inf",
AND ( 'Type'[Type] = "inf", SEARCH ( "{A}", 'Type'[Con_type],, 0 ) > 0 )
)
)
)
Si esto funciona para usted, márquelo como la solución. Los elogios también son apreciados. Por favor, avísame si no.
saludos
palmadita
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
No fue perfecto, pero me dio una idea que funcionó para mí.
Muchas gracias por su ayuda
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |