Forum Discussion
Spekko
Helper I
5 years agoFilter data based on date-field in other table
After lurking frequently in this community, time for my first post. Is it posible to filter results in a visual based on the contents of another table? In this case: i've got Marketing Qualified...
- 5 years ago
Hi Spekko ,
Try this:
1. Create relationship between the two tables.
2. Create measures:
- Show all related information after the MQLDate.
Measure 1 = IF ( MIN ( 'Lead'[Lead Create Date] ) > SELECTEDVALUE ( 'MQL'[MQLDate] ), 1 )- Show only the first lead after the MQLDate.
Measure 2 = VAR MinLeadCreateDate = CALCULATE ( MIN ( 'Lead'[Lead Create Date] ), FILTER ( ALLSELECTED ( 'Lead' ), 'Lead'[MQL Id] = SELECTEDVALUE ( 'MQL'[MQL ID] ) && 'Lead'[Lead Create Date] > SELECTEDVALUE ( MQL[MQLDate] ) ) ) RETURN IF ( SELECTEDVALUE ( MQL[MQL ID] ) = BLANK (), 1, IF ( MIN ( 'Lead'[Lead Create Date] ) = MinLeadCreateDate, 1 ) )3. Put measures into "Filters on this visual" field of needed visuals and set "is 1", then test.
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Icey
Community Support
5 years agoHi Spekko ,
Try this:
1. Create relationship between the two tables.
2. Create measures:
- Show all related information after the MQLDate.
Measure 1 = IF ( MIN ( 'Lead'[Lead Create Date] ) > SELECTEDVALUE ( 'MQL'[MQLDate] ), 1 )
- Show only the first lead after the MQLDate.
Measure 2 =
VAR MinLeadCreateDate =
CALCULATE (
MIN ( 'Lead'[Lead Create Date] ),
FILTER (
ALLSELECTED ( 'Lead' ),
'Lead'[MQL Id] = SELECTEDVALUE ( 'MQL'[MQL ID] )
&& 'Lead'[Lead Create Date] > SELECTEDVALUE ( MQL[MQLDate] )
)
)
RETURN
IF (
SELECTEDVALUE ( MQL[MQL ID] ) = BLANK (),
1,
IF ( MIN ( 'Lead'[Lead Create Date] ) = MinLeadCreateDate, 1 )
)
3. Put measures into "Filters on this visual" field of needed visuals and set "is 1", then test.
BTW, .pbix file attached.
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Spekko
Helper I
5 years agoWow that really helps! Thanks for the effort you put in!