Forum Discussion
Show Data from date range from 2 date tables with no relationships
- 11 months ago
Hi eliasayyy , you can follow these steps to get your required solution
1. Keep only one active relationship: dimDate[Date] โ Fact[DateKey].
StartDate and EndDate tables must be disconnected (no relationships to anything). Use them only for slicers.
2. Axis/rows: fields from dimDate (e.g., dimDate[DayName], dimDate[Date]).
Never put StartDate/EndDate columns on the visual.
3. Replace your DAXMeasure in Selected Range := VAR _start = MIN ( StartDate[Date] ) VAR _end = MAX ( EndDate[Date] ) RETURN IF ( NOT ISBLANK ( _start ) && NOT ISBLANK ( _end ) && _start <= _end, CALCULATE ( [My Measure], -- e.g. SUM(Fact[value]) KEEPFILTERS ( dimDate[Date] >= _start ), KEEPFILTERS ( dimDate[Date] <= _end ) ) )
KEEPFILTERS preserves the visualโs dimDate[DayName] context.
Filtering the column (dimDate[Date] >= _start / <= _end) avoids the dependency on having dimDate[Date] in the visual.
โญHope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
๐กFound it helpful? Show some love with kudos ๐ as your support keeps our community thriving!
๐Letโs keep building smarter, data-driven solutions together!๐ [Explore More]
Hi eliasayyy , you can follow these steps to get your required solution
1. Keep only one active relationship: dimDate[Date] โ Fact[DateKey].
StartDate and EndDate tables must be disconnected (no relationships to anything). Use them only for slicers.
2. Axis/rows: fields from dimDate (e.g., dimDate[DayName], dimDate[Date]).
Never put StartDate/EndDate columns on the visual.
3. Replace your DAX
Measure in Selected Range :=
VAR _start = MIN ( StartDate[Date] )
VAR _end = MAX ( EndDate[Date] )
RETURN
IF (
NOT ISBLANK ( _start ) &&
NOT ISBLANK ( _end ) &&
_start <= _end,
CALCULATE (
[My Measure], -- e.g. SUM(Fact[value])
KEEPFILTERS ( dimDate[Date] >= _start ),
KEEPFILTERS ( dimDate[Date] <= _end )
)
)
KEEPFILTERS preserves the visualโs dimDate[DayName] context.
Filtering the column (dimDate[Date] >= _start / <= _end) avoids the dependency on having dimDate[Date] in the visual.
โญHope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
๐กFound it helpful? Show some love with kudos ๐ as your support keeps our community thriving!
๐Letโs keep building smarter, data-driven solutions together!๐ [Explore More]