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.
Hola
He creado una tabla calculada basada en otra tabla calculada como una solución temporal, ya que no pude crear una medida para obtener el resultado esperado. Me pregunto, si esto podría ser más bien convertido en una medida
Tengo una tabla calculada "CountrsPerDay" que tiene datos agrupados por día, countyId, SubCategoryId, categoryId, usuario, facilityId como abajo
Fecha | Identificación del condado | SubCategoryId | Idcategoría | Usuario | FacilityId |
5/26/2020 | E0069 | 1 | 1 | SL-AE01 | 164 |
5/26/2020 | E0069 | 3 | 1 | SL-AE02 | 164 |
5/26/2020 | E0069 | 3 | 1 | SL-AE03 | 164 |
5/26/2020 | E0069 | 1 | 1 | SL-AE04 | 164 |
5/26/2020 | E0069 | 1 | 1 | SL-AE05 | 164 |
5/26/2020 | E0069 | 2 | 2 | SL-AE06 | 164 |
5/26/2020 | E0069 | 2 | 2 | SL-AE07 | 164 |
5/27/2020 | E0069 | 1 | 1 | SL-AE01 | 164 |
5/27/2020 | E0069 | 1 | 1 | SL-AE08 | 164 |
5/27/2020 | E0069 | 2 | 2 | SL-AE06 | 164 |
5/27/2020 | E0069 | 2 | 2 | SL-AE07 | 164 |
5/26/2020 | E0010 | 1 | 1 | SL-E05 | 165 |
5/26/2020 | E0010 | 2 | 2 | SL-E06 | 165 |
5/26/2020 | E0010 | 2 | 2 | SL-E07 | 165 |
5/27/2020 | E0010 | 2 | 2 | SL-E06 | 165 |
5/28/2020 | E0010 | 2 | 2 | SL-E07 | 165 |
5/26/2020 | E0011 | 3 | 1 | SL-08 | 165 |
5/27/2020 | E0011 | 2 | 2 | SL-09 | 165 |
5/28/2020 | E0011 | 3 | 1 | SL-08 | 165 |
i creó 2 tablas calculadas más usando los datos anteriores con el siguiente dax para obtener el estado de cada instalación y otra tabla calculada para obtener el estado de cada condado (abajo)
SummaryByGS
VAR CombinedTable = ADDCOLUMNS(CountsPerDay, "PCsCount", RELATED('PCData'[PCCount]))
RETURN
ADDCOLUMNS(
CALCULATETABLE(
SUMMARIZE(
CombinedTable,
CountsPerDay[date],
CountsPerDay[countyId],
"TotalPCCount",MIN('PCData'[PCCount]),
"TotalUsers", CALCULATE(COUNT(CountsPerDay[TUser]), FILTER(CountsPerDay, CountsPerDay[CategoryId] = 2))
),
FILTER(CategoryCountsPerDay, CountsPerDay[CategoryId] = 2)
) ,
"PercentUse", DIVIDE([TotalUsers],[TotalPCCount])*100.0, //Validation
"UseStatus", SWITCH(
TRUE(),
DIVIDE([TotalHosts],[TotalPCCount])*100.0 <= 1 || [TotalPCCount] <=5, "None",
DIVIDE([TotalHosts],[TotalPCCount])*100.0 <= 30, "Minimal",
DIVIDE([TotalHosts],[TotalPCCount])*100.0 > 30, "Regular"
)
)
PCData Table está relacionado a través de County Id, tiene PCCounts por CountyId
Identificación del Condado | PCCount |
E0069 | 50 |
E0010 | 30 |
E0011 | 5 |
El resultado final se muestra en tablas y objetos visuales de pila de barras que muestran diferentes valores de estado y porcentaje;
filtros utilizados - CountyId, FacilityId, Date (un día o rango de fechas)
Se trata de un gran conjunto de datos con 4+millones de filas y en crecimiento. Por lo tanto, yo apreciaría, si cualquier1 aquí podría ayudarme a convertir estas tablas calculadas en una medida
Solved! Go to Solution.
Hay @vdr,
¿Tal vez así? Ni seguro y su fórmula parece no coincidir con el campo de la tabla.
Percentage =
var TotalPCCount = MIN('PCData'[PCCount])
var TotalUsers =
CALCULATE (
COUNT ( CountsPerDay[User] ),
FILTER ( CountsPerDay, CountsPerDay[CategoryId] = 2 )
)
return
DIVIDE(TotalUsers,TotalPCCount) * 100
UseStatus =
var TotalPCCount = MIN('PCData'[PCCount])
var TotalUsers =
CALCULATE (
COUNT ( CountsPerDay[User] ),
FILTER ( CountsPerDay, CountsPerDay[CategoryId] = 2 )
)
return
SWITCH (
TRUE (),
DIVIDE ( TotalUsers, TotalPCCount ) * 100.0 <= 1
|| TotalPCCount <= 5, "None",
DIVIDE ( TotalUsers, TotalPCCount ) * 100.0 <= 30, "Minimal",
DIVIDE ( TotalUsers, TotalPCCount ) * 100.0 > 30, "Regular"
)
O bien, puede considerar compartir un archivo .pbix de ejemplo ficticio para una mayor discusión.
Saludos
Yingjie Li
Si esta publicación ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hay @vdr,
¿Tal vez así? Ni seguro y su fórmula parece no coincidir con el campo de la tabla.
Percentage =
var TotalPCCount = MIN('PCData'[PCCount])
var TotalUsers =
CALCULATE (
COUNT ( CountsPerDay[User] ),
FILTER ( CountsPerDay, CountsPerDay[CategoryId] = 2 )
)
return
DIVIDE(TotalUsers,TotalPCCount) * 100
UseStatus =
var TotalPCCount = MIN('PCData'[PCCount])
var TotalUsers =
CALCULATE (
COUNT ( CountsPerDay[User] ),
FILTER ( CountsPerDay, CountsPerDay[CategoryId] = 2 )
)
return
SWITCH (
TRUE (),
DIVIDE ( TotalUsers, TotalPCCount ) * 100.0 <= 1
|| TotalPCCount <= 5, "None",
DIVIDE ( TotalUsers, TotalPCCount ) * 100.0 <= 30, "Minimal",
DIVIDE ( TotalUsers, TotalPCCount ) * 100.0 > 30, "Regular"
)
O bien, puede considerar compartir un archivo .pbix de ejemplo ficticio para una mayor discusión.
Saludos
Yingjie Li
Si esta publicación ayuda, por favor considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
¡Gracias! Exactamente lo que estaba buscando, pero el requisito cambió. Necesito calcular el percentil durante un período de tiempo ahora y por alguna razón el percentil no funciona correctamente como medida. Por lo tanto, tengo que volver a la tabla calculada y utilizar los recuentos en la medida para calcular el percentil
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 |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |