209 похожих чатов

Добрый день, подскажите как можно интерполировать данные в PQ? Date

надо дополнить чтобы были строки StartOfMonth?

8 ответов

30 просмотров

Table.AddColumn(#"Changed Type1", "Date", each List.Transform({1..12}, (x)=> #date([Год], x,1)))

let Source = Excel.CurrentWorkbook(){[Name="Население_2"]}[Content], typ = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Население", Int64.Type}}), lst=List.Buffer({0..11}), g=(x,y,z)=>[a=List.Transform(lst,(i)=>Date.AddMonths(x,i)), b=(z-y)/12, c=List.Transform(lst,(i)=>y+b*i), d=List.Zip({a,c})][d], f=(x)=>[a=Table.AddIndexColumn(x,"i",1,1), b=List.Buffer(x[Население]), c=Table.TransformColumns(a,{"i",(i)=>b{i}?}), d=Table.AddColumn(c,"lst",(r)=>if r[i]=null then {{r[Date],r[Население]}} else g(r[Date],r[Население],r[i]))][d], gr = Table.Group(typ, "Города", {"tmp", f}), tbl = Table.Combine(gr[tmp]), exp = Table.ExpandListColumn(tbl, "lst"), splt=Table.SplitColumn(exp,"lst",(x)=>x,{"дата","значение"}) in splt

Chasing-Happiness Автор вопроса
Сергей
Table.AddColumn(#"Changed Type1", "Date", each Lis...

Спасибо огромное. Можно как то интерполировать население тоже в PQ? Например в 2010 году 100к а в 2011 220к, то есть по месяцам данные будет расти примерно на 10к , 100к январь 110к февраль и тк далее.

Chasing-Happiness Автор вопроса
Mikhail Muzykin
let Source = Excel.CurrentWorkbook(){[Name="На...

То что нужно, спасибо большое 👍

Mikhail Muzykin
а интерполяция?

не увидел на картинке в разделе "как надо")))

let Source = Excel.CurrentWorkbook(){[Name="Население_2"]}[Content], tableRemoveColumns = Table.RemoveColumns(Source,{"Date"}), tableGroup = Table.Group( tableRemoveColumns, "Города", { "temp", (x) => [ tableSort = Table.Sort( x, {"Год", Order.Ascending} ), iYears = List.Buffer( tableSort[Год] ), iPopulation = List.Buffer( tableSort[Население] ), iYearsZip = List.Zip( { iYears, List.Skip(iYears), iPopulation, List.Skip( iPopulation ) } ), listTransform = List.Transform( iYearsZip, (y) => [ iYearStart = Number.From( y{0} ), iYearEnd = Number.From( y{1} ), startDate = #date( iYearStart, 1, 1 ), endDate = if y{3} is null then startDate else #date( iYearEnd, 1, 1 ), iDiffMonths = if y{3} is null then 1 else ( iYearEnd - iYearStart ) * 12, iDiffPop = if y{3} is null then y{2} else ( ( y{3} - y{2} ) / iDiffMonths ), listDiffMonths = { 0..iDiffMonths - 1 }, listDates = List.Transform( listDiffMonths, (z) => [ date = Date.AddMonths( startDate, z ), pop = y{2} + iDiffPop * z, list = { date , pop } ][ list ] ), tableFromRows = Table.FromRows( listDates, {"Дата", "Население"}) ][ tableFromRows ] ), tableCombine = Table.Combine( listTransform ) ][ tableCombine ] } ), tableExpand = Table.ExpandTableColumn(tableGroup, "temp", {"Дата", "Население"}, {"Дата", "Население"}) in tableExpand

Andrey Kozlenok
let Source = Excel.CurrentWorkbook(){[Name="На...

точняк, там же не все года, тогда так: let Source = Excel.CurrentWorkbook(){[Name="Население_2"]}[Content], typ = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Население", Int64.Type}, {"Год", Int64.Type}}), g=(x,y,z)=>[n=(z{1}-Date.Year(x))*12, lst=List.Buffer({0..(n-1)}), a=List.Transform(lst,(i)=>Date.AddMonths(x,i)), b=(z{0}-y)/n, c=List.Transform(lst,(i)=>y+b*i), d=List.Zip({a,c})][d], f=(x)=>[a=Table.AddIndexColumn(x,"i",1,1), b=List.Buffer(Table.ToList(x[[Население],[Год]],(x)=>x)), c=Table.TransformColumns(a,{"i",(i)=>b{i}?}), d=Table.AddColumn(c,"lst",(r)=>if r[i]=null then {{r[Date],r[Население]}} else g(r[Date],r[Население],r[i])), e=d[[Города],[lst]]][e], gr = Table.Group(typ, "Города", {"tmp", f}), tbl = Table.Combine(gr[tmp]), exp = Table.ExpandListColumn(tbl, "lst"), splt=Table.SplitColumn(exp,"lst",(x)=>x,{"дата","значение"}) in splt

Похожие вопросы

Обсуждают сегодня

@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Hello, Is iExec also part of the "inception program" or another one ? Would it be a name to qualified the nature of the relationship between iExec and Nvidia? And does Secret ...
Ñïķøłäś
8
Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
any reference of this implementation?
BitBuddha
29
Also, why can’t the community have a vote/ say when it comes to initiatives like buybacks. Isn’t the point of crypto decentralisation? Don’t we deserve input as long term supp...
👨🏽‍🦰
13
Hi guys, any problem with Pulsebrige? Trying to transfer from wETH to ETH. First it tells me to connect my metamask "through mobile app" not desktop. Then I did and confirmed ...
Snowflakecrypto
13
Карта сайта