cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mark_Clipsham
Frequent Visitor

Calcular con filtros Mutliple no funciona

Hola

Tengo una tabla que estoy tratando de resumir en otra tabla utilizando una serie de funciones de cálculo que aplican varios filtros, sin embargo los filtros parecen no funcionar.

Mi código actual:

Tabla 1:

Mark_Clipsham_0-1602752334153.png

Código para el Cuadro 2:

STD Attendance % = 
SUMMARIZE('Attendance Calcs',
    'Attendance Calcs'[school_student_id],
    "Total Pos Days HT 1 20/21", CALCULATE(
                            SUM('Attendance Calcs'[Value]), FILTER('Attendance Calcs', 'Attendance Calcs'[Attendance Classification] = "In" || 'Attendance Calcs'[Attendance Classification] = "Out" && 'Attendance Calcs'[Week] = "2020/21 Week 1" || 'Attendance Calcs'[Week] = "2020/21 Week 2" || 'Attendance Calcs'[Week] = "2020/21 Week 3" || 'Attendance Calcs'[Week] = "2020/21 Week 4" || 'Attendance Calcs'[Week] = "2020/21 Week 5" || 'Attendance Calcs'[Week] = "2020/21 Week 6" || 'Attendance Calcs'[Week] = "2020/21 Week 7" || 'Attendance Calcs'[Week] = "2020/21 Week 8")),
    "Total Days In HT 1 20/21", CALCULATE(
                            SUM('Attendance Calcs'[Value]), FILTER('Attendance Calcs', 'Attendance Calcs'[Attendance Classification] = "In" && 'Attendance Calcs'[Week] = "2020/21 Week 1" || 'Attendance Calcs'[Week] = "2020/21 Week 2" || 'Attendance Calcs'[Week] = "2020/21 Week 3" || 'Attendance Calcs'[Week] = "2020/21 Week 4" || 'Attendance Calcs'[Week] = "2020/21 Week 5" || 'Attendance Calcs'[Week] = "2020/21 Week 6" || 'Attendance Calcs'[Week] = "2020/21 Week 7" || 'Attendance Calcs'[Week] = "2020/21 Week 8")))

Fuera de la mesa 2:

Mark_Clipsham_1-1602752470053.png

Así que está claro que las funciones están haciendo caso omiso de los filtros y sólo sumando toda la tabla, pero no estoy seguro de por qué está sucediendo esto?

Consejos sería muy apreciado!

Gracias

1 ACCEPTED SOLUTION

Hola @Mark_Clipsham ,

Puede crear dos medidas como se indica a continuación para obtenerlas:

Total Pos Days HT 1 20/21 = 
CALCULATE (
    SUM ( 'Attendance Calcs'[Value] ),
    FILTER (
        'Attendance Calcs',
         'Attendance Calcs'[Attendance Classification] in { "In", "Out"}
            && 'Attendance Calcs'[Week]
            IN {
            "2020/21 Week 1",
            "2020/21 Week 2",
            "2020/21 Week 3",
            "2020/21 Week 4",
            "2020/21 Week 5",
            "2020/21 Week 6",
            "2020/21 Week 7",
            "2020/21 Week 8"
        }
    )
)
Total Days HT 1 20/21 = 
CALCULATE (
    SUM ( 'Attendance Calcs'[Value] ),
    FILTER (
        'Attendance Calcs',
        'Attendance Calcs'[Attendance Classification] = "In"
            && 'Attendance Calcs'[Week]
            IN {
            "2020/21 Week 1",
            "2020/21 Week 2",
            "2020/21 Week 3",
            "2020/21 Week 4",
            "2020/21 Week 5",
            "2020/21 Week 6",
            "2020/21 Week 7",
            "2020/21 Week 8"
        }
    )
)

Calculate with Mutliple Filters Not working.JPG

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
yingyinr
Community Support
Community Support

Hola @Mark_Clipsham ,

¿Cuál es el valor correcto de campo [ Total Pos Days HT1 20/21] y [ Total Days In HT 1 20/21]? ¿Podría por favor proporcionar su lógica de calcación?

Total Pos Days HT 1 20/21o los valores totales que la clasificación de asistencia es ( "IN" o "OUT") y la semana en 2020/21 semana 1-semana 8 ?
Total de días en HT 1 20/21o los valores totales que la clasificación de asistencia es "IN" y semana en 2020/21 semana 1-semana 8 ?

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hola Rena,

Sí, lo tienes correcto.

La lógica es que 'Total Pos Days HT 1 20/21' sería igual a la suma de la columna de valor para todas las filas donde 'Clasificación de Asistencia' - IN o OUT y 'Semana' - 2020/21 Semana 1 a La Semana 8.

Entonces 'Total días en HT 1 20/21' sería el mismo, pero 'Clasificación de asistencia' - IN solamente.

Así que en este escenario:

'Total Pos Days HT 1 20/21'
'Total de Días HT 1 20/21'

Espero que tenga sentido,

Gracias

Hola @Mark_Clipsham ,

Puede crear dos medidas como se indica a continuación para obtenerlas:

Total Pos Days HT 1 20/21 = 
CALCULATE (
    SUM ( 'Attendance Calcs'[Value] ),
    FILTER (
        'Attendance Calcs',
         'Attendance Calcs'[Attendance Classification] in { "In", "Out"}
            && 'Attendance Calcs'[Week]
            IN {
            "2020/21 Week 1",
            "2020/21 Week 2",
            "2020/21 Week 3",
            "2020/21 Week 4",
            "2020/21 Week 5",
            "2020/21 Week 6",
            "2020/21 Week 7",
            "2020/21 Week 8"
        }
    )
)
Total Days HT 1 20/21 = 
CALCULATE (
    SUM ( 'Attendance Calcs'[Value] ),
    FILTER (
        'Attendance Calcs',
        'Attendance Calcs'[Attendance Classification] = "In"
            && 'Attendance Calcs'[Week]
            IN {
            "2020/21 Week 1",
            "2020/21 Week 2",
            "2020/21 Week 3",
            "2020/21 Week 4",
            "2020/21 Week 5",
            "2020/21 Week 6",
            "2020/21 Week 7",
            "2020/21 Week 8"
        }
    )
)

Calculate with Mutliple Filters Not working.JPG

Saludos

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Eso funcionó perfectamente, gracias Rena.

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!