Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Necesito contar "meses completos" cuando el año fiscal es del 1 de julio al 30 de junio.
El año fiscal 2020 está completo. Meses completos = 12
El año fiscal 2021 no está completo. Meses completos = 10 (julio-abril)
"Total" debe ser igual a 22 (12+10)
El problema es que no hay necesariamente datos para cada mes, por ejemplo:
He intentado:
Dónde _Num = DistinctCountNoBlank(Amounts[MonthYr]) - devuelve 3
Var _Num = Calculate(DistinctCountNoBlank(Amounts[MonthYr]),Allselected()) - devuelve 9 sin importar lo que muestre la columna
¿Hay alguna manera posible de hacer esto?
Relaciones entre tablas:
Solved! Go to Solution.
Pruebe esta medida:
Count Months =
VAR vCurrentYear =
MAX ( Dates[Fiscal Year] )
VAR vMaxMonthYrInCurrentYear =
MAX ( Amounts[MonthYr] )
VAR vMaxYear =
CALCULATE ( YEAR ( MAX ( Amounts[MonthYr] ) ), ALL ( Dates ) )
VAR vMonthCount =
CALCULATE (
DISTINCTCOUNT ( Dates[Fiscal Month] ),
Dates[Date] <= vMaxMonthYrInCurrentYear,
ALL ( Dates ),
VALUES ( Dates[Fiscal Year] )
)
VAR vResult =
--if the current year is not the latest year, then the current year is complete (i.e. 12 months);
--otherwise, count the number of months in the current year that are <= the latest month of the current year
IF (
vCurrentYear < vMaxYear,
12,
vMonthCount
)
RETURN
vResult
Pruebe esta medida:
Count Months =
VAR vCurrentYear =
MAX ( Dates[Fiscal Year] )
VAR vMaxMonthYrInCurrentYear =
MAX ( Amounts[MonthYr] )
VAR vMaxYear =
CALCULATE ( YEAR ( MAX ( Amounts[MonthYr] ) ), ALL ( Dates ) )
VAR vMonthCount =
CALCULATE (
DISTINCTCOUNT ( Dates[Fiscal Month] ),
Dates[Date] <= vMaxMonthYrInCurrentYear,
ALL ( Dates ),
VALUES ( Dates[Fiscal Year] )
)
VAR vResult =
--if the current year is not the latest year, then the current year is complete (i.e. 12 months);
--otherwise, count the number of months in the current year that are <= the latest month of the current year
IF (
vCurrentYear < vMaxYear,
12,
vMonthCount
)
RETURN
vResult
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the February 2025 Power BI update to learn about new features.