Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
11 | |
10 | |
10 | |
9 | |
8 |
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
9 |