Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
Hi,
First of all, my dataset is in year and month level. I dont have any dates.
For calculating YTD, MTD and QTD, i have taken the first date of all months.
Second thing is, my data is based on fiscal year starting from october.
I have used ,
Solved! Go to Solution.
You need to make slight changes in data model.
1) Create a date column from year and month
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddRLjsMwCADQu2TdBf/PLWZf9f7XmODWmk4gCyuRnzBghTyfxw8ej4MA43xYLWY+Xo8OLh4jEGjOwNDBzyXiNAJF2AxkMoKKzmDun6PokpxDG9TCQJ9BeAYDhxkUeARS7MlzdY693Fzl+hzhuq/kCxAqJI1uxDNncdn5+SLKLl3wHUOzmAvPggiDVDXIeSMK+wo+Uu3XYWLBI5DyDWTgG+QPKgf77v8CZPuaL+C6q/qCSqdmPMK5TyOwQz9K1qDw5wPT/4AoNAIJeIN61RQcwVNvIoS4Qc21IMsIZtFzrH+HczZYcw0SI2iYjuCWvao1cxS9jwIW7+UuIDqTv34B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Product = _t, Year = _t, Month = _t, Amount = _t]), Date = Table.AddColumn(Source, "Date", each #date(Number.From([Year]),Number.From([Month]),1)), ChangedType = Table.TransformColumnTypes(Date,{{"Product", type text}, {"Year", Int64.Type}, {"Month", Int64.Type}, {"Amount", Int64.Type}, {"Date", type date}}) in ChangedType
2) Use below measure to calculate YTD values
Measure = CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Date]>=DATE(2018,10,1) && 'Table'[Date]<=TODAY()))
3) Similarly you can create other measures
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
You need to make slight changes in data model.
1) Create a date column from year and month
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddRLjsMwCADQu2TdBf/PLWZf9f7XmODWmk4gCyuRnzBghTyfxw8ej4MA43xYLWY+Xo8OLh4jEGjOwNDBzyXiNAJF2AxkMoKKzmDun6PokpxDG9TCQJ9BeAYDhxkUeARS7MlzdY693Fzl+hzhuq/kCxAqJI1uxDNncdn5+SLKLl3wHUOzmAvPggiDVDXIeSMK+wo+Uu3XYWLBI5DyDWTgG+QPKgf77v8CZPuaL+C6q/qCSqdmPMK5TyOwQz9K1qDw5wPT/4AoNAIJeIN61RQcwVNvIoS4Qc21IMsIZtFzrH+HczZYcw0SI2iYjuCWvao1cxS9jwIW7+UuIDqTv34B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Product = _t, Year = _t, Month = _t, Amount = _t]), Date = Table.AddColumn(Source, "Date", each #date(Number.From([Year]),Number.From([Month]),1)), ChangedType = Table.TransformColumnTypes(Date,{{"Product", type text}, {"Year", Int64.Type}, {"Month", Int64.Type}, {"Amount", Int64.Type}, {"Date", type date}}) in ChangedType
2) Use below measure to calculate YTD values
Measure = CALCULATE(SUM('Table'[Amount]),FILTER('Table','Table'[Date]>=DATE(2018,10,1) && 'Table'[Date]<=TODAY()))
3) Similarly you can create other measures
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
User | Count |
---|---|
98 | |
90 | |
83 | |
70 | |
67 |
User | Count |
---|---|
113 | |
104 | |
101 | |
73 | |
65 |