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 estoy creando una tabla, donde i continuamente necesita comparar los resultados del mes actual con el mismo mes el año pasado y el mes pasado.
He creado columnas separadas para EL MES ANTERIOR y EL MISMO PERIODO DEL Último Año, pero estoy en duda cómo crear un filtro que incluya ambos, ¿puede alguien ayudar
Hola, @bilingual
Si usted toma la respuesta de alguien, por favor márquela como la solución para ayudar a los otros miembros que tienen los mismos problemas a encontrarla más rápidamente. Si no, avísame y trataré de ayudarte más. Gracias.
Saludos
Allan
Estimado @bilingual ,
Hay una manera fácil,
Puede hacer lo que es duplicar la columna que desea visualizar en el modelo. Asígnelo como el año pasado.
A continuación, al agregar esas dos columnas en la tabla, agregue el filtro respectivo en los objetos visuales desde el panel de filtro, es decir, para la columna orignal, agregue el filtro de fecha para este mes. Y para la columna duplicada que nombramos como el año pasado añadir filtro de los últimos años mes ..
Esta es una forma muy sencilla de 👍
saludos
Sujit Thakur
Por favor, dar felicitaciones si te gusta este creativo y fácil pensarinh y aceptar mi post como solución para que otras personas como nosotros pueden tener esta idea 👍👍
Hola, @bilingual
Según su descripción, creé datos para reproducir su escenario. El archivo pbix se adjunta al final.
pestaña:
Prueba:
No hay ninguna relación entre dos tablas. Puede crear medidas como se indica a continuación.
Current Month =
IF(
ISFILTERED(Test[Period]),
IF(
"Current Month" in DISTINCT(Test[Period]),
CALCULATE(
SUM(Tab[Value]),
FILTER(
ALLSELECTED(Tab),
YEAR(Tab[Date])=YEAR(SELECTEDVALUE(Tab[Date]))&&
MONTH(Tab[Date])=MONTH(SELECTEDVALUE(Tab[Date]))
)
)
)
)
Last Month =
IF(
ISFILTERED(Test[Period]),
IF(
"Last Month" in DISTINCT(Test[Period]),
CALCULATE(
SUM(Tab[Value]),
FILTER(
ALL(Tab),
Tab[Date]>=EOMONTH(SELECTEDVALUE(Tab[Date]),-2)+1&&
Tab[Date]<=EOMONTH(SELECTEDVALUE(Tab[Date]),-1)
)
)
)
)
Last Year Same Month =
IF(
ISFILTERED(Test[Period]),
IF(
"Last Year Same Month" in DISTINCT(Test[Period]),
CALCULATE(
SUM(Tab[Value]),
FILTER(
ALLSELECTED(Tab),
YEAR(Tab[Date])=YEAR(SELECTEDVALUE(Tab[Date]))-1&&
MONTH(Tab[Date])=MONTH(SELECTEDVALUE(Tab[Date]))
)
)
)
)
Resultado:
Saludos
Allan
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
@bilingual , Si necesita una columna en la tabla del calendario puede tener así
Switch( True(),
eomonth([Date],0) > á eomonth(Today(),-1),"Last Month" ,
eomonth([Date],0) > áomonth(Today(),0),"This Month" ,
eomonth([Date],0) > á eomonth(Today(),-12),"Last Year Same Month" ,
Format([Date],"MMM-AAAA")
)
Pero en caso de que nee medidas se puede utilizar la inteligencia de tiempo con la tabla de fechas
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))
last year MTD (complete) Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
Month behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Month))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
Consulte también : https://community.powerbi.com/t5/Community-Blog/Decoding-Direct-Query-in-Power-BI-Part-1-Time-Intell...
Para obtener lo mejor de la función de inteligencia del tiempo. Asegúrese de que tiene un calendario de fechas y que se ha marcado como la fecha en la vista de modelo. Además, únase a ella con la columna de fecha de su/s hecho/s. Consulte:
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/
Vea si mi seminario web sobre Time Intelligence puede ayudar: https://community.powerbi.com/t5/Webinars-and-Video-Gallery/PowerBI-Time-Intelligence-Calendar-WTD-Y...
Apreciamos tus Felicitaciones.
Gracias a lot Amit, tengo un pequeño problema ya que los datos se agregan sólo en meses no fechas, por lo que la fórmula no está funcionando, ¿podría ayudar con una solución alternativa para la fórmula Switch?
Hola, @bilingual
Si desea que los datos se agreguen solo en meses, puede crear columnas y medidas calculadas como se indica a continuación. El archivo pbix se adjunta al final.
Calculated column:
Year = YEAR(Tab[Date])
Month = MONTH(Tab[Date])
Measure:
Current Month =
IF(
ISFILTERED(Test[Period]),
IF(
"Current Month" in DISTINCT(Test[Period]),
CALCULATE(
SUM(Tab[Value]),
FILTER(
ALLSELECTED(Tab),
YEAR(Tab[Date])=SELECTEDVALUE(Tab[Year])&&
MONTH(Tab[Date])=SELECTEDVALUE(Tab[Month])
)
)
)
)
Last Month =
IF(
ISFILTERED(Test[Period]),
IF(
"Last Month" in DISTINCT(Test[Period]),
IF(
SELECTEDVALUE(Tab[Month])>1,
CALCULATE(
SUM(Tab[Value]),
FILTER(
ALL(Tab),
Tab[Year]=SELECTEDVALUE(Tab[Year])&&
Tab[Month]=SELECTEDVALUE(Tab[Month])-1
)
),
IF(
SELECTEDVALUE(Tab[Month])=1,
CALCULATE(
SUM(Tab[Value]),
FILTER(
ALL(Tab),
Tab[Year]=SELECTEDVALUE(Tab[Year])-1&&
Tab[Month]=12
)
)
)
)
)
)
Last Year Same Month =
IF(
ISFILTERED(Test[Period]),
IF(
"Last Year Same Month" in DISTINCT(Test[Period]),
CALCULATE(
SUM(Tab[Value]),
FILTER(
ALLSELECTED(Tab),
Tab[Year]=SELECTEDVALUE(Tab[Year])-1&&
Tab[Month]=SELECTEDVALUE(Tab[Month])
)
)
)
)
Resultado:
Saludos
Allan
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola Allan, lo siento la respuesta tardía debido a las vacaciones de verano, realmente agradezco su ayuda!
He intentado usar su ejemplo para trabajar con mi conjunto de datos, pero no parece, puedo hacerlo funcionar, ¿podría ser tan amable de ayudarme? - He adjuntado una versión muy simple de los datos alineados con su ejemplo.
El mes pasado tiene algunos problemas con los resultados, ya que parece agregar los resultados en lugar de mostrar el mes pasado
Enlace al archivo : Archivo de Power BI con datos agregados
Hola
Comparta sus datos de muestra.
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 |