This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreGet Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.
Bom dia,
Tenho uma tabela fato (F_Cargas) na qual tenhos as granularidades data, filial, mesorregião, tipo de operação, modelo veicular e transportadora.
Através dessa tabela eu consigo calcular os totais de frete - Frete = SUM(f_cargas[vl_frete_sem_imposto]), e também consigo o total do escopoa atual de análises - Frete cargas ativas = CALCULATE([Frete],f_cargas[Ativo?] = 1). O mesmo vale para quantidade de cargas - Qtde Cargas = DISTINCTCOUNT(f_cargas[cd_carga]) e Qtde cargas ativas = CALCULATE([Qtde Cargas],f_cargas[Ativo?] = 1).
A empresa trabalha com ano fiscal, que inicia em março e termina em fevereiro do ano seguinte. Felizmente há a coluna "Ano Safra", do tipo string, em D_Calendário para facilitar o desenvolvimento (exemplo: "2024/2025", "2025/2026").
Eu preciso obter o total de frete do ano safra anterior, dividí-lo pelo total de cargas do ano safra anterior (Qtde Cargas) e multiplicar pela quantidade de cargas do escopo atual (Qtde cargas ativas) para obter o frete projetado do ano aterior no ano atual.
Meu maior desafio é aplicar todas as dimensões citadas acima em um visual de tabela junto essa medida. Preciso de algo leve, rápido e performático
Solved! Go to Solution.
@leonssouza Hi! I'll try to explain it in english, use the translator please.
First, create a column in D_Calendar:
FiscalYearIndex =
YEAR ( D_Calendar[Date] ) +
IF ( MONTH ( D_Calendar[Date] ) >= 3, 1, 0 )
Then calculate these base measures:
Freight =
SUM ( f_cargas[vl_frete_sem_imposto] )
Load Count =
DISTINCTCOUNT ( f_cargas[cd_carga] )
Active Load Count =
CALCULATE (
[Load Count],
f_cargas[Ativo?] = 1
)
Measure for Freight prev fiscal year:
Freight PY =
VAR CurrentFiscalYear =
MAX ( D_Calendar[FiscalYearIndex] )
RETURN
CALCULATE (
[Freight],
D_Calendar[FiscalYearIndex] = CurrentFiscalYear - 1
)
Measure for load count prev fiscal year:
Load Count PY =
VAR CurrentFiscalYear =
MAX ( D_Calendar[FiscalYearIndex] )
RETURN
CALCULATE (
[Load Count],
D_Calendar[FiscalYearIndex] = CurrentFiscalYear - 1
)
Measure for freight average:
Avg Freight PY =
DIVIDE (
[Freight PY],
[Load Count PY]
)
Final measure:
Projected Freight (PY applied to CY) =
[Avg Freight PY]
* [Active Load Count]
BBF
@leonssouza Hi! I'll try to explain it in english, use the translator please.
First, create a column in D_Calendar:
FiscalYearIndex =
YEAR ( D_Calendar[Date] ) +
IF ( MONTH ( D_Calendar[Date] ) >= 3, 1, 0 )
Then calculate these base measures:
Freight =
SUM ( f_cargas[vl_frete_sem_imposto] )
Load Count =
DISTINCTCOUNT ( f_cargas[cd_carga] )
Active Load Count =
CALCULATE (
[Load Count],
f_cargas[Ativo?] = 1
)
Measure for Freight prev fiscal year:
Freight PY =
VAR CurrentFiscalYear =
MAX ( D_Calendar[FiscalYearIndex] )
RETURN
CALCULATE (
[Freight],
D_Calendar[FiscalYearIndex] = CurrentFiscalYear - 1
)
Measure for load count prev fiscal year:
Load Count PY =
VAR CurrentFiscalYear =
MAX ( D_Calendar[FiscalYearIndex] )
RETURN
CALCULATE (
[Load Count],
D_Calendar[FiscalYearIndex] = CurrentFiscalYear - 1
)
Measure for freight average:
Avg Freight PY =
DIVIDE (
[Freight PY],
[Load Count PY]
)
Final measure:
Projected Freight (PY applied to CY) =
[Avg Freight PY]
* [Active Load Count]
BBF
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 25 | |
| 24 | |
| 22 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 43 | |
| 42 | |
| 41 | |
| 21 | |
| 21 |