Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
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
Hello all,
I need to create either a calculated column in DAX or a custom column in PowerQuery that compare two date columns in two tables. The output is a column that has the value in the second table that is closest to the first table that is greater than the first table. I am unable to upload the file directly. However, this is the first table:
Here is the second:
And here is the desired output with the comparison being done on the Begin Date in the first table and the Date column in the second
Solved! Go to Solution.
Hi @BryceJones ,
You can achieve your goal by creating a new calculated column in first table with this DAX:
Closest Date =
VAR CurrentBeginDate = 'FirstTable'[Begin Date]
RETURN
MINX(
FILTER(
'SecondTable',
'SecondTable'[Date] > CurrentBeginDate
),
'SecondTable'[Date]
)
Your output will look like this:
Hi @BryceJones ,
You can achieve your goal by creating a new calculated column in first table with this DAX:
Closest Date =
VAR CurrentBeginDate = 'FirstTable'[Begin Date]
RETURN
MINX(
FILTER(
'SecondTable',
'SecondTable'[Date] > CurrentBeginDate
),
'SecondTable'[Date]
)
Your output will look like this:
@BryceJones , A new column in Table 1
Maxx(filter(Table2, Table2[Date] >= Table1[Start Date] && Table2[Date] <= Table1[End Date]) , Table2[Date])
Thank you. To clarify Begin Date and Date are the only dates in my scenario that need this comparison performed on.
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 |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 64 | |
| 31 | |
| 29 | |
| 24 |