Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi
i have a table Sprints like:
id | start date | end date
i have another table Issues that has a column that contains date, lets call it changeDate
i would like to add to that table a column that returns the id from the first table if changeDate is between start and end dates
tried something like:
FIRSTNONBLANK(Sprints[id],DATESBETWEEN(Issues[changeDate], Sprints[startDate].[Date], Sprints[endDate].[Date]))
but i get errors "A single value for column 'startDate' in table 'Sprints' cannot be determined. "
any idea how to acomplish this?
hey,
My both tables look like this
Table1
aDate 2017-01-23 2017-01-15 2017-01-26 2017-02-15
Table2 looks like this
id startdate enddate 1 2017-01-01 2017-01-10 2 2017-01-11 2017-01-21 3 2017-01-22 2017-02-10 4 2017-02-11 2017-02-28
I create a calculated column in Table1 that pulls the id from Table2 from that record where the column aDate is between startdate and enddate (assumption, there is no overlap in the ranges and there are also no gaps in the ranges).
The calculated column
CALCULATE(
MAX('Table2'[id])
,FILTER(
'Table2','Table2'[startdate] <= 'Table1'[aDate] && 'Table2'[enddate] >= 'Table1'[aDate])
)Hope this helps
Regards
thanks, this is whay i needed
but, i do have gaps in the sprint dates, and i assume this is why im getting the same sprint for all rows
Hey,
can you please share some sample data.
Regards
You are refering to the DAX solution?
The Power Query solution should work fine. ![]()
My suggestion would be to expand the Sprints table, so you have a row for each date.
This is done by importing the dates as whole number and later on these are converted back to dates.
Now you can merge the other table with the expanded sprints table on the date columns.
let
Source = Excel.CurrentWorkbook(){[Name="Sprints"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"id", Int64.Type}, {"start date", Int64.Type}, {"end date", Int64.Type}}),
#"Added Custom" = Table.AddColumn(#"Changed Type", "Dates", each {[start date]..[end date]}),
#"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"start date", "end date"}),
#"Expanded Dates" = Table.ExpandListColumn(#"Removed Columns", "Dates"),
#"Changed Type1" = Table.TransformColumnTypes(#"Expanded Dates",{{"Dates", type date}})
in
#"Changed Type1"let
Source = Table.NestedJoin(AnotherTable,{"changeDate"},ExpandedSprints,{"Dates"},"ExpandedSprints",JoinKind.LeftOuter),
#"Expanded ExpandedSprints" = Table.ExpandTableColumn(Source, "ExpandedSprints", {"id"})
in
#"Expanded ExpandedSprints"
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 18 | |
| 18 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 33 | |
| 32 | |
| 32 |