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.
Buenas tardes
Estoy perplejo y su ayuda estará muy agradecida, estoy tratando de calcular la mediana en la fecha máxima del mes en la tabla que es octubre, por lo que para octubre quiero contar los registros de julio, agosto y septiembre y luego calcular la mediana para esos 3 meses y luego comparar el conteo de octubre con mediana. Por ejemplo,
Mes | Contar |
Julio | 1023 |
Agosto | 455 |
Septiembre | 816 |
La mediana debe ser 816 y luego puedo compararlo con el total de octubre. Que es 224. Los recuentos provienen de una medida.
Tengo la siguiente medida, pero el problema es que no se salta octubre y cuando se añaden los últimos "3 meses" Añade agosto septiembre y octubre, en lugar de julio agosto y septiembre,
Solved! Go to Solution.
Thank you all very much I ended up doing the following
Created my 5 measure of last 5 months (As i needed 5 months count to calculate median)
One = calculate (COUNT(ClaimsConvertedData[CustID]), DATESINPERIOD ( ClaimsConvertedData[PROCDATE], EOMONTH ( MAX ( ClaimsConvertedData[PROCDATE] ), -1 ), -1, MONTH ),FILTER(ClaimsConvertedData,ClaimsConvertedData[T&C Identifier]="Y"))
Two = calculate (COUNT(ClaimsConvertedData[CustID]), DATESINPERIOD ( ClaimsConvertedData[PROCDATE], EOMONTH ( MAX ( ClaimsConvertedData[PROCDATE] ), -2 ), -1, MONTH ),FILTER(ClaimsConvertedData,ClaimsConvertedData[T&C Identifier]="Y"))
and so on.
The following is the measure that returns the median.
median = MEDIANX(
Union(
ROW("Measure", "Measure 1", "Measure Value",[One]),
ROW("Measure", "Measure 2", "Measure Value",[Two]),
ROW("Measure", "Measure 3", "Measure Value",[Three]),
ROW("Measure", "Measure 4", "Measure Value",[Four]),
ROW("Measure", "Measure 5", "Measure Value",[Five])
),[Measure Value])
sum by month =
SUMMARIZE('Table','Table'[month],"sum by month",SUM('Table'[salemount]))
Mdeiam = CALCULATE(
MEDIAN('sum by month'[sum by month]),
FILTER('sum by month',
'sum by month'[month]>=MAXX(ALL('sum by month'),[month])-3
&&'sum by month'[month]<=MAXX(ALL('sum by month'),[month])-1))
_last_month_sum =
CALCULATE(
SUM('sum by month'[sum by month]),
FILTER('sum by month',
'sum by month'[month]=MAXX(ALL('sum by month'),[month])))
compare =
IF(
'sum by month'[_last_month_sum]>'sum by month'[Mdeiam],
TRUE(),
FALSE()
)
Puede descargar el archivo PBIX desde aquí.
Saludos
Liu Yang
Si este post Ayuda, entonces por favor considere Acédárlo como solución para ayudar a los otros miembros a encontrarlo más rápidamente.
@v-yangliu-msft Thank you for your response. Doing a table is not possible as it has about 10 different slicers. and the total is dependent on what they selected and calculations needed to be done on the fly.
Thank you all very much I ended up doing the following
Created my 5 measure of last 5 months (As i needed 5 months count to calculate median)
One = calculate (COUNT(ClaimsConvertedData[CustID]), DATESINPERIOD ( ClaimsConvertedData[PROCDATE], EOMONTH ( MAX ( ClaimsConvertedData[PROCDATE] ), -1 ), -1, MONTH ),FILTER(ClaimsConvertedData,ClaimsConvertedData[T&C Identifier]="Y"))
Two = calculate (COUNT(ClaimsConvertedData[CustID]), DATESINPERIOD ( ClaimsConvertedData[PROCDATE], EOMONTH ( MAX ( ClaimsConvertedData[PROCDATE] ), -2 ), -1, MONTH ),FILTER(ClaimsConvertedData,ClaimsConvertedData[T&C Identifier]="Y"))
and so on.
The following is the measure that returns the median.
median = MEDIANX(
Union(
ROW("Measure", "Measure 1", "Measure Value",[One]),
ROW("Measure", "Measure 2", "Measure Value",[Two]),
ROW("Measure", "Measure 3", "Measure Value",[Three]),
ROW("Measure", "Measure 4", "Measure Value",[Four]),
ROW("Measure", "Measure 5", "Measure Value",[Five])
),[Measure Value])
Hey @mukhan169 ,
Puede probar esto:
Last 3 Months =
VAR _CurrentMonth =
MAX ( SalesTable[Month] )
VAR _CurrentValue =
MAX ( SalesTable[Count] )
VAR _EndMonth =
EOMONTH ( _CurrentMonth, -2 ) + 1
VAR _Filter =
DATESINPERIOD ( SalesTable[Month], _EndMonth, -3, MONTH )
VAR _Last3Month =
IF (
HASONEVALUE ( SalesTable[Count] ),
CALCULATE ( MEDIAN ( SalesTable[Count] ), _Filter )
)
VAR _Compare = _Last3Month - _CurrentValue
RETURN
_Compare
¡Salud!
Vivek
Blog: vivran.in/my-blog
Conectarse en LinkedIn
Seguir en Twitter
Hola @vivran22
Gracias por su ayuda. Todavía estoy confundido acerca de
VAR _CurrentValue =
MAX ( SalesTable[Count] )
Como no tengo claro cómo estamos calculando el conteo antes de tomar la mediana.
New try 1 =
VAR _CurrentMonth =
MAX ( ClaimsConvertedData[PROCDATE] )
VAR _CurrentValue =
MAX ( ClaimsConvertedData[PROCDATE] )
VAR _EndMonth =
EOMONTH ( _CurrentMonth, -2 ) + 1
VAR _Filter =
DATESINPERIOD ( ClaimsConvertedData[PROCDATE], _EndMonth, -3, MONTH )
VAR _Last3Month =
calculate (COUNT(ClaimsConvertedData[ID]),_Filter)
return _Last3Month
calculó el recuento de 2169. para julio, agosto y Spetember deben ser 1023 +455+816-2294 Y todavía no estoy seguro de cómo enviar esos valores a mediana.
Lo siento si su pregunta tonta, pero su ayuda está muy apreciada.
¿Puede compartir el archivo de datos/pbix de ejemplo?
Mis aportaciones con comentarios sobre la medida a continuación:
New try 1 =
//Identifies the current month in the filter context
VAR _CurrentMonth =
MAX ( ClaimsConvertedData[PROCDATE] )
//Identifies the current value in the filter context
VAR _CurrentValue =
MAX ( ClaimsConvertedData[PROCDATE] )
//Identifies the Previous month in the filter context
VAR _EndMonth =
EOMONTH ( _CurrentMonth, -2 ) + 1
//Gives the table with all the dates in last 3 months (excluding current month)
VAR _Filter =
DATESINPERIOD ( ClaimsConvertedData[PROCDATE], _EndMonth, -3, MONTH )
VAR _Last3Month =
calculate (COUNT(ClaimsConvertedData[ID]),_Filter)
return _Last3Month
¡Salud!
Vivek
Blog: vivran.in/my-blog
Conectarse en LinkedIn
Seguir en Twitter
https://drive.google.com/file/d/1oGP4EIHSlV2kDo7SDXMDTCfrQ8lYIYlF/view?usp=sharing
@vivran22 please find the attached samle file. As I explained before For October count I want to calculate count for July, August and september which should be 696,440 and 452 and then calculate the median of them which should be 452. Greatly appriciate your help.
Thank you.
@mukhan169 Te he enviado una solicitud de acceso para el archivo.
¡Salud!
Vivek
Blog: vivran.in/my-blog
Conectarse en LinkedIn
Seguir en Twitter
@vivran22 You should have access now per your request. Sorry about the confusion.
https://drive.google.com/file/d/1oGP4EIHSlV2kDo7SDXMDTCfrQ8lYIYlF/view?usp=sharing
@vivran22 I did not receive the request this is the link for the google drive which should be accessiable . If it is not could you please let me know how to give you access?
@mukhan169 , Pruebe una medida como ejemplo. Prefiere usar la tabla de fechas
Rolling 3 hasta el último 1 mes - CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],-1,month)),-3,MONTH))
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.
Proporcione sus comentarios y consejos para nuevos videos
Tutorial Series Dax Vs SQL Direct Query PBI Consejos
Apreciamos tus Felicitaciones.
Gracias, pero no estoy usando la tabla de fechas y esta es la nueva característica que estoy agregando en el informe de exsisting.
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 | |
2 | |
2 | |
2 | |
1 |