Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
sns1996
Helper I
Helper I

Cálculo de projeção

Pessoal,
Estou precisando criar um gráfico com a projeção de reclamações para os próximos três meses
Abaixo segue a regra para criação das projeção
 
No mês de outubro
MêsReclamaçõesProjeçãoRegra
pôr576576Mês fechado
para um 730(576/0,30)*0,38
Novembro 384(576/0,30)*0,20
dez 173(576/0,30)*0,09
    
No mês de Novembro
MêsReclamaçõesProjeçãoRegra
pôr576576Mês fechado
para um589589Mês fechado
Novembro 288(576+589/0,68)*0,20
dez 130(576+589/0,68)*0,09
    
No mês de Dezembro
MêsReclamaçõesProjeçãoRegra
pôr576576Mês fechado
para um589589Mês fechado
Novembro350350Mês fechado
dez 141(576+589+350/0,88)*0,09

 

Desde já agradeço a ajuda

3 ACCEPTED SOLUTIONS
lbendlin
Super User
Super User

where are these rules defined?  0.3, 0.38, 0.2, 0.09 ?  Is that something that is fix or do you expect to be able to model these?

 

Your numbers for November and December are off by a bit.

 

lbendlin_0-1729548431436.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dcyxDYAwDETRXVxHyL7IEM8SZf81iBIsGWGKu+IXr3cSpkI2p9c5n49Kozx53Y4tVPGKEOGRbVfJXXFXm71oyWhJaeQ0/mg4XZWjjo8+bg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, #"Projected Month" = _t, Actual = _t, Weight = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", Int64.Type}, {"Projected Month", Int64.Type}, {"Actual", Currency.Type}, {"Weight", type number}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Projection", (k)=>  k[Actual] ?? (let f=Table.SelectRows(#"Changed Type",each [Month]=k[Month] and [Projected Month] < k[Projected Month] and [Actual]<>null) in List.Sum(f[Actual])/List.Sum(f[Weight])*k[Weight]),Currency.Type)
in
    #"Added Custom"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.

View solution in original post

Estes valores são alterados anualmente, eles estão em uma tabela

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

where are these rules defined?  0.3, 0.38, 0.2, 0.09 ?  Is that something that is fix or do you expect to be able to model these?

 

Your numbers for November and December are off by a bit.

 

lbendlin_0-1729548431436.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("dcyxDYAwDETRXVxHyL7IEM8SZf81iBIsGWGKu+IXr3cSpkI2p9c5n49Kozx53Y4tVPGKEOGRbVfJXXFXm71oyWhJaeQ0/mg4XZWjjo8+bg==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Month = _t, #"Projected Month" = _t, Actual = _t, Weight = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Month", Int64.Type}, {"Projected Month", Int64.Type}, {"Actual", Currency.Type}, {"Weight", type number}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Projection", (k)=>  k[Actual] ?? (let f=Table.SelectRows(#"Changed Type",each [Month]=k[Month] and [Projected Month] < k[Projected Month] and [Actual]<>null) in List.Sum(f[Actual])/List.Sum(f[Weight])*k[Weight]),Currency.Type)
in
    #"Added Custom"

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the Source step with your own source.

São três tabelas

Tabelas reclamações com os a quantidade de reclamações por dia
Tabela calendario
Tabela fator (0.3, 0.38, 0.2, 0.09)

lbendlin_0-1729548718400.png

 

Estes valores são alterados anualmente, eles estão em uma tabela

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.