Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi All-
I have a measure that is used to calulcate the last date record before a specific date. This measure works correctly as long as all of my fields are from the original table. However, if I add a field from a dimension table (relationship 1-many) the two tables duplicate all the values. The relationship also works fine when I do not have the measure added.
My Measure is:
Is Last Before Selection =
var tbl1 = CALCULATETABLE(Filter(FactForecasts2, FactForecasts2[Date] <= [Selected Allocation Date]), ALLEXCEPT(FactForecasts2, FactForecasts2[Item], FactForecasts2[Group]))
var maxDate = MAXX(tbl1, [Date])
return calculate(maxDate = Max([Date]))
Selected Allocation Date is also a measure getting the date from a slicer:
Selected Allocation Date = VALUES(Dates[Date])
On the report in Power BI I have 3 visuals.
The data that I have created is pretty simple.
DimProducts
Group | Description |
Group1 | Description 1 |
Group2 | Description 2 |
FactForecasts
Group | Item | Date | Qty | Other |
Group1 | Item1 | 44927 | 100 | X |
Group1 | Item1 | 45078 | 110 | Y |
Group1 | Item1 | 45200 | 90 | Z |
Group1 | Item2 | 45078 | 80 | A |
Group1 | Item2 | 45170 | 70 | B |
Group2 | Item1 | 44928 | 101 | XX |
Group2 | Item1 | 45079 | 102 | YY |
Group2 | Item1 | 45201 | 103 | ZZ |
Dates (For the slicer)
Date |
1/15/2023 |
7/15/2023 |
10/15/2023 |
Thanks in advance for any insight.