Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I need help, I have a table with some values for my current year (in this example it is year 2015) and I would like to replicate all values from 2015 to year 2016 by adding 10%.
I would like to do this using Power Query if possible, but it could be with DAX as well.
Example download link: https://1drv.ms/u/s!At5JlMR_naI1gf4y5TmX0kd625M3aw?e=BdI8ri
Solved! Go to Solution.
@lcfaria
I created a new table using DAX as follows and I think it should be fine for you.
Fact Result =
UNION (
'fact - Issue',
SELECTCOLUMNS (
ADDCOLUMNS ( 'fact - Issue', "New Value", 'fact - Issue'[Value] * 1.1 ),
"Date", EDATE ( 'fact - Issue'[Date], 12 ),
"Name", 'fact - Issue'[Name],
"Value", [New Value]
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Hi @lcfaria ,
How about this:
Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUByIjA0NTJR0lRyA2NDBQitVBk3ACYiNsEs4gHaYICSNcRhnhMsoIw6hYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Name = _t, Value = _t]),
#"Add One Year" = Table.ReplaceValue(Source,each [Date],each Date.AddYears([Date], 1),Replacer.ReplaceValue,{"Date"}),
#"Value times 1.1" = Table.ReplaceValue(#"Add One Year",each [Value],each [Value] * 1.1,Replacer.ReplaceValue,{"Value"}),
#"Appended Query" = Table.Combine({Source, #"Value times 1.1"}),
#"Changed Type" = Table.TransformColumnTypes(#"Appended Query",{{"Date", type date}, {"Name", type text}, {"Value", Int64.Type}})
in
#"Changed Type"
Let me know if this helps or if you get stuck somewhere 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
Hi @lcfaria ,
How about this:
Here the code in Power Query M that you can paste into the advanced editor (if you do not know, how to exactly do this, please check out this quick walkthrough)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjDUByIjA0NTJR0lRyA2NDBQitVBk3ACYiNsEs4gHaYICSNcRhnhMsoIw6hYAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Name = _t, Value = _t]),
#"Add One Year" = Table.ReplaceValue(Source,each [Date],each Date.AddYears([Date], 1),Replacer.ReplaceValue,{"Date"}),
#"Value times 1.1" = Table.ReplaceValue(#"Add One Year",each [Value],each [Value] * 1.1,Replacer.ReplaceValue,{"Value"}),
#"Appended Query" = Table.Combine({Source, #"Value times 1.1"}),
#"Changed Type" = Table.TransformColumnTypes(#"Appended Query",{{"Date", type date}, {"Name", type text}, {"Value", Int64.Type}})
in
#"Changed Type"
Let me know if this helps or if you get stuck somewhere 🙂
/Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Did I answer your question❓➡️ Please, mark my post as a solution ✔️ |
Also happily accepting Kudos 🙂 |
Feel free to connect with me on LinkedIn! |
#proudtobeasuperuser |
@lcfaria
I created a new table using DAX as follows and I think it should be fine for you.
Fact Result =
UNION (
'fact - Issue',
SELECTCOLUMNS (
ADDCOLUMNS ( 'fact - Issue', "New Value", 'fact - Issue'[Value] * 1.1 ),
"Date", EDATE ( 'fact - Issue'[Date], 12 ),
"Name", 'fact - Issue'[Name],
"Value", [New Value]
)
)
⭕ Subscribe and learn Power BI from these videos
⚪ Website ⚪ LinkedIn ⚪ PBI User Group
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.