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
Necesitaría una medida que me devolvie el año en que el mayor beneficio fue. Datos como tabla a continuación.
Thx
David
Fecha | Beneficio |
1.1.2020 | 5 |
1.2.2020 | 4 |
5.10.2020 | 6 |
6.5.2018 | 8 |
6.4.2019 | 9 |
... |
Solved! Go to Solution.
Encontré la resolución:
year_with_max_profit =
var distinc_table = ADDCOLUMNS(KEEPFILTERS(VALUES('Table'[Date].[Year])), "profit", CALCULATE(COUNTA('Table'[id])))
var maxobj = MAXX(
distinc_table,
CALCULATE(COUNTA('Table'[id]))
)
return CALCULATE(MIN('Table'[Year]), FILTER(distinc_table , [profit] = maxobj))
Hola @Davidkm ,
Estos son los pasos que puede seguir:
1. Cree una columna calculcada.
Year = YEAR('Table'[Date])
Month = MONTH('Table'[Date])
2. Crear medida.
Max_Month =
var _1=
MAXX(ALL('Table'),'Table'[Profit])
return CALCULATE(MAX('Table'[Year]),FILTER('Table','Table'[Profit]=_1))
3. Resultado.
Puede descargar el archivo PBIX desde aquí.
Saludos
Liu Yang
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola Liu,
la asignación es diferente. Quería saber el año en el que la cantidad de ganancias para todo el año es la más grande.
D.
Encontré la resolución:
year_with_max_profit =
var distinc_table = ADDCOLUMNS(KEEPFILTERS(VALUES('Table'[Date].[Year])), "profit", CALCULATE(COUNTA('Table'[id])))
var maxobj = MAXX(
distinc_table,
CALCULATE(COUNTA('Table'[id]))
)
return CALCULATE(MIN('Table'[Year]), FILTER(distinc_table , [profit] = maxobj))
@Davidkm, con ayuda de la tabla de fecha tomar máximo de beneficios
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
This year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR('Date'[Date]),"12/31"))
Last year Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
//Only year vs Year, not a level below
This Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('order'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
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, únete a ella con la columna de fecha de tus hechos. Consulte :radacad sqlbi My Video Series Aprecia tus Felicitaciones.
Hola
esto no es lo que quiero. Necesito un año y no un beneficio. En mi ejemplo necesito obtener 2020.
Thx
David
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 |