Forum Discussion
Running Total Cohort DAX
- Anonymous6 years ago
Hola @1katznir
Creo que desea calcular el total de ejecución para cada Start_OF_Month_Date por Cohort_Month.
Y compare el gasto con la medida para calcular el mínimo Cohort_Month para cada Start_OF_Month.
Construyo dos medidas:
Running Total Booking Amount = SUMX ( FILTER ( ALL ( BOOKING_MONTHLY_COHORT ), BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] = MAX ( BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] ) && BOOKING_MONTHLY_COHORT[Cohort_Month] <= MAX ( BOOKING_MONTHLY_COHORT[Cohort_Month] ) ), BOOKING_MONTHLY_COHORT[Booking_Amount] )M.Cohort_Month = VAR _RunningTotalExpense_Amount = SUMX ( FILTER ( ALL ( BOOKING_MONTHLY_COHORT ), BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] = MAX ( BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] ) && BOOKING_MONTHLY_COHORT[Cohort_Month] <= MAX ( BOOKING_MONTHLY_COHORT[Cohort_Month] ) ), BOOKING_MONTHLY_COHORT[Expense_Amount] ) VAR _COHORT = MINX ( FILTER ( ALL ( BOOKING_MONTHLY_COHORT ), BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] = MAX ( BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] ) && [Running Total Booking Amount] >= _RunningTotalExpense_Amount ), BOOKING_MONTHLY_COHORT[Cohort_Month] ) RETURN IF(NOT(ISBLANK(_COHORT)),IF(MAX(BOOKING_MONTHLY_COHORT[Cohort_Month])=_COHORT,_COHORT,BLANK()),BLANK())El resultado es el siguiente.
Puede descargar el archivo pbix desde este enlace: Ejecución de Total Cohort DAX
Saludos
Rico Zhou
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Here is a sample of the data structure, note:
- Additional columns exists that provide further breakdowns as described above
Hola @1katznir
Creo que desea calcular el total de ejecución para cada Start_OF_Month_Date por Cohort_Month.
Y compare el gasto con la medida para calcular el mínimo Cohort_Month para cada Start_OF_Month.
Construyo dos medidas:
Running Total Booking Amount =
SUMX (
FILTER (
ALL ( BOOKING_MONTHLY_COHORT ),
BOOKING_MONTHLY_COHORT[Start_OF_Month_Date]
= MAX ( BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] )
&& BOOKING_MONTHLY_COHORT[Cohort_Month]
<= MAX ( BOOKING_MONTHLY_COHORT[Cohort_Month] )
),
BOOKING_MONTHLY_COHORT[Booking_Amount]
)M.Cohort_Month =
VAR _RunningTotalExpense_Amount =
SUMX (
FILTER (
ALL ( BOOKING_MONTHLY_COHORT ),
BOOKING_MONTHLY_COHORT[Start_OF_Month_Date]
= MAX ( BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] )
&& BOOKING_MONTHLY_COHORT[Cohort_Month]
<= MAX ( BOOKING_MONTHLY_COHORT[Cohort_Month] )
),
BOOKING_MONTHLY_COHORT[Expense_Amount]
)
VAR _COHORT =
MINX (
FILTER (
ALL ( BOOKING_MONTHLY_COHORT ),
BOOKING_MONTHLY_COHORT[Start_OF_Month_Date]
= MAX ( BOOKING_MONTHLY_COHORT[Start_OF_Month_Date] )
&& [Running Total Booking Amount] >= _RunningTotalExpense_Amount
),
BOOKING_MONTHLY_COHORT[Cohort_Month]
)
RETURN
IF(NOT(ISBLANK(_COHORT)),IF(MAX(BOOKING_MONTHLY_COHORT[Cohort_Month])=_COHORT,_COHORT,BLANK()),BLANK())
El resultado es el siguiente.
Puede descargar el archivo pbix desde este enlace: Ejecución de Total Cohort DAX
Saludos
Rico Zhou
Si este post ayuda,entonces considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.